Commit 88ec06c2 authored by Gabriel F. T. Gomes's avatar Gabriel F. T. Gomes

New upstream version 1.3.4

parent 87f21f7b
==============================================================
Overview of changes between Pragha 1.3.3 and 1.3.2.2
Overview of changes between Pragha 1.3.4 and 1.3.3
==============================================================
V1.3.4
Codename: "Cherry, cherry, cherry pick..."
News:
Fixes some border, spacing and margin in all gui.
Various improvements to the tag editor dialog.
Others Changes:
Implement emit CanNext/Prev/Play/Pause/Seek. Issue #123
Use Alt+Return shortcut to edit the selected song.
Some backport of improvents to MTP plugin
Allow build with grilo-0.2 and grilo-0.3.
Set user-agent and ssl strict ssl to gstreamer on internet music.
Fix second sidebar dont show with accel. Issue #73
Allow apply a custom css. Related to Issue #64, #87
Allows to customize the styles to the distro packagers.
Bugs fixed:
Fix Incorrect Can* properties of the MPRIS Specification #123
Fix wrong Wiki address. Issue #138
Fix segmentation fault when close deactivate mpris plugin.
Remove use-hint preferences that was removed..
Fix GtkDialog mapped without a transient parent..
Dont use keybinder plugin on wayland. Issue #118
Dont use X11 session on wayland.
Use same accel -Shift-F9- to show second sidebar that gnome-builder. Issue #73
Align to center the toolbar icons instead vertical fill. Issue #10
Fix toolbar shows 00:60 instead of 01:00. Issue #103
Remove custom invisible char of lastfm password
Update dlna-renderer plugin. Issue #94
Update dlna plugin to rygel 2.6.
Prefer non symbolic icons. Fix blured menu icon.. Issue #85
Avoid opening unknown files on Taglib.
Fix TuneIn when it offers many results.
Updates Translations:
Nothing here since transifex dont use versions and change so much.
==============================================================
OTHERS REALESES:
==============================================================
V1.3.3
Codename: "Just a preamp..."
News:
......@@ -29,10 +72,6 @@ Updates Translations:
Update Bulgarian translation thanks to lyubomirv.
Update Swedish translation thanks to monotux.
==============================================================
OTHERS REALESES:
==============================================================
V1.3.2.2
Codename: "Gtk 3.14: Que cunda el panico. haha. ;)"
......
......@@ -6,12 +6,12 @@ dnl
dnl Version information
m4_define([pragha_version_major], [1])
m4_define([pragha_version_minor], [3])
m4_define([pragha_version_micro], [3])
m4_define([pragha_version_micro], [4])
m4_define([pragha_version], [pragha_version_major().pragha_version_minor().pragha_version_micro()])
dnl Initialize autoconf
AC_COPYRIGHT([Copyright (c) 2009-2015
AC_COPYRIGHT([Copyright (c) 2009-2019
Matias De lellis <mati86dl@gmail.com>])
AC_INIT([pragha], [pragha_version()], [mati86dl@gmail.com])
AC_CONFIG_HEADERS([config.h])
......@@ -159,22 +159,40 @@ dnl Check rygel
RYGEL_FOUND="no"
if test x"$LIBPEAS_FOUND" = x"yes"; then
XDT_CHECK_OPTIONAL_PACKAGE([RYGEL],
[rygel-server-2.2], [0.20.0],
[rygel-server-2.2],
[rygel-server-2.2 library], [yes])
[rygel-server-2.6], [0.20.0],
[rygel-server-2.6],
[rygel-server-2.6 library], [yes])
else
AM_CONDITIONAL([HAVE_RYGEL], 0)
fi
dnl Check grilo
GRILO_FOUND="no"
GRILO3_FOUND="no"
GRILO2_FOUND="no"
if test x"$LIBPEAS_FOUND" = x"yes"; then
XDT_CHECK_OPTIONAL_PACKAGE([GRILO],
[grilo-0.2], [0.2.10],
XDT_CHECK_OPTIONAL_PACKAGE([GRILO3],
[grilo-0.3], [0.3.0],
[grilo-0.3],
[grilo-0.3 library], [yes])
if test x"$GRILO3_FOUND" = x"no"; then
XDT_CHECK_OPTIONAL_PACKAGE([GRILO2],
[grilo-0.2], [0.2.11],
[grilo-0.2],
[grilo-0.2 library], [yes])
else
AM_CONDITIONAL([HAVE_GRILO], 0)
AM_CONDITIONAL([HAVE_GRILO2], 0)
fi
else
AM_CONDITIONAL([HAVE_GRILO3], 0)
AM_CONDITIONAL([HAVE_GRILO2], 0)
fi
if test x"$GRILO3_FOUND" = x"yes"; then
GRILO_FOUND="yes"
fi
if test x"$GRILO2_FOUND" = x"yes"; then
GRILO_FOUND="yes"
fi
dnl Check libclastfm
......@@ -291,8 +309,8 @@ echo " * Controls Pragha using multimedia keys....(Need keybinder-3.0 >= 0.2.0
echo " * Search lyrics, artists info and albums art.....(Need libglyr >= 1.0.1).: $LIBGLYR_FOUND"
echo " * Search metadata on AcoustID.....................(Need libsoup >= 2.38).: $LIBSOUP_FOUND"
echo " * Search radios on TuneIn.........................(Need libsoup >= 2.38).: $LIBSOUP_FOUND"
echo " * Share music library on DLNA............(Need rygel-server-2.2 >= 0.20).: $RYGEL_FOUND"
echo " * Play songs on DLNA Servers..................(Need grilo-0.2 >= 0.2.10).: $GRILO_FOUND"
echo " * Share music library on DLNA............(Need rygel-server-2.6 >= 0.20).: $RYGEL_FOUND"
echo " * Play songs on DLNA Servers......................(Need grilo >= 0.2.11).: $GRILO_FOUND"
echo " * Lastfm scroble, and add similar songs support (Need libclastfm >= 0.5).: $LIBCLASTFM_FOUND"
echo " * EXPERIMENTAL management of removable devices..........(Need gudev-1.0).: $GUDEV_FOUND"
echo " * EXPERIMENTAL management of mtp devices....:(Need gudev-1.0 and libmtp).: $LIBMTP_FOUND"
......@@ -301,4 +319,4 @@ echo " Others build options..:"
echo " * Cubic volume support.....................(Need gstreamer-plugins-base).: $GSTREAMER_AUDIO_FOUND"
echo " * Better session management support........(Need libxfce4ui-2 >= 4.11.0).: $LIBXFCE4UI_FOUND"
echo " * Use totem-pl-parser to open playlists....(Need totem-plparser >= 2.26).: $PLPARSER_FOUND"
echo ""
echo ""
\ No newline at end of file
......@@ -43,7 +43,10 @@ if HAVE_RYGEL
SUBDIRS += dlna
endif
if HAVE_GRILO
if HAVE_GRILO3
SUBDIRS += dlna-renderer
endif
if HAVE_GRILO2
SUBDIRS += dlna-renderer
endif
......
......@@ -245,6 +245,8 @@ pragha_acoustid_plugin_get_metadata_done (SoupSession *session,
if (prechanged) {
dialog = pragha_tags_dialog_new ();
gtk_window_set_transient_for (GTK_WINDOW(dialog),
GTK_WINDOW(pragha_application_get_window(priv->pragha)));
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (pragha_acoustid_dialog_response), plugin);
......
......@@ -89,6 +89,23 @@ pragha_gudev_dialog_new (GtkWidget *parent, const gchar *title, const gchar *ico
return dialog;
}
/* Helper */
gint
pragha_gudev_get_property_as_int (GUdevDevice *device,
const gchar *property,
gint base)
{
const char *strvalue;
strvalue = g_udev_device_get_property (device, property);
if (strvalue == NULL) {
return 0;
}
return strtol (strvalue, NULL, base);
}
/* Identify devices.*/
static gint
......@@ -250,4 +267,4 @@ pragha_device_client_get (void)
}
return device_client;
}
\ No newline at end of file
}
......@@ -72,6 +72,11 @@ pragha_gudev_dialog_new (GtkWidget *parent, const gchar *title, const gchar *ico
const gchar *primary_text, const gchar *secondary_text,
const gchar *first_button_text, gint first_button_response);
gint
pragha_gudev_get_property_as_int (GUdevDevice *device,
const gchar *property,
gint base);
/* Create a new instance of PraghaDeviceClient* */
PraghaDeviceClient *pragha_device_client_get (void);
......
......@@ -14,7 +14,6 @@ libpdlnarenderer_la_SOURCES = \
libpdlnarenderer_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
libpdlnarenderer_la_CFLAGS = \
$(GRILO_CFLAGS) \
$(GSTREAMER_CFLAGS) \
$(GSTREAMER_BASE_CFLAGS) \
$(GLIB_CFLAGS) \
......@@ -28,7 +27,6 @@ libpdlnarenderer_la_CFLAGS = \
-Wall
libpdlnarenderer_la_LIBADD = \
$(GRILO_LIBS) \
$(GSTREAMER_LIBS) \
$(GLIB_LIBS) \
$(GIO_LIBS) \
......@@ -38,6 +36,15 @@ libpdlnarenderer_la_LIBADD = \
$(LIBPEAS_LIBS) \
$(LIBPEAS_GTK_LIBS)
if HAVE_GRILO3
libpdlnarenderer_la_CFLAGS += $(GRILO3_CFLAGS)
libpdlnarenderer_la_LIBADD += $(GRILO3_LIBS)
endif
if HAVE_GRILO2
libpdlnarenderer_la_CFLAGS += $(GRILO2_CFLAGS)
libpdlnarenderer_la_LIBADD += $(GRILO2_LIBS)
endif
if HAVE_GSTREAMER_AUDIO
libpdlnarenderer_la_CFLAGS += $(GSTREAMER_AUDIO_CFLAGS)
libpdlnarenderer_la_LIBADD += $(GSTREAMER_AUDIO_LIBS)
......
......@@ -145,7 +145,12 @@ pragha_dlna_renderer_append_source (GList *list,
caps = grl_source_get_caps (source, GRL_OP_BROWSE);
options = grl_operation_options_new (caps);
#ifdef HAVE_GRILO3
grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_IDLE_RELAY);
#endif
#ifdef HAVE_GRILO2
grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY);
#endif
medias = grl_source_browse_sync (source, container, keys, options, NULL);
for (media_iter = medias; media_iter; media_iter = g_list_next (media_iter)) {
......@@ -154,10 +159,20 @@ pragha_dlna_renderer_append_source (GList *list,
media = GRL_MEDIA (media_iter->data);
#ifdef HAVE_GRILO3
if (grl_media_is_container (media)) {
#endif
#ifdef HAVE_GRILO2
if (GRL_IS_MEDIA_BOX (media)) {
#endif
list = pragha_dlna_renderer_append_source (list, source, media);
}
#ifdef HAVE_GRILO3
else if (grl_media_is_audio (media)) {
#endif
#ifdef HAVE_GRILO2
else if (GRL_IS_MEDIA_AUDIO (media)) {
#endif
list = pragha_dlna_renderer_append_media (list, media);
}
pragha_process_gtk_events ();
......@@ -236,7 +251,13 @@ pragha_plugin_activate (PeasActivatable *activatable)
grl_init (NULL, NULL);
registry = grl_registry_get_default ();
if (!grl_registry_load_plugin_by_id (registry, "grl-upnp", &error)) {
#ifdef HAVE_GRILO3
if (!grl_registry_load_all_plugins (registry, FALSE, &error) ||
!grl_registry_activate_plugin_by_id (registry, "grl-dleyna", &error)) {
#endif
#ifdef HAVE_GRILO2
if (!grl_registry_load_plugin_by_id (registry, "grl-dleyna", &error)) {
#endif
g_print ("Failed to load plugins: %s\n\n", error->message);
}
......
......@@ -67,7 +67,6 @@ pragha_dlna_plugin_append_track (PraghaDlnaPlugin *plugin,
gint id)
{
RygelMusicItem *item = NULL;
RygelMediaObject *object;
gchar *uri = NULL, *u_title = NULL, *item_id = NULL, *content_type = NULL;
const gchar *file = NULL, *title = NULL;
gboolean uncertain;
......@@ -84,24 +83,27 @@ pragha_dlna_plugin_append_track (PraghaDlnaPlugin *plugin,
RYGEL_MUSIC_ITEM_UPNP_CLASS);
if (item != NULL) {
rygel_music_item_set_artist (item, pragha_musicobject_get_artist(mobj));
rygel_music_item_set_album (item, pragha_musicobject_get_album(mobj));
rygel_music_item_set_track_number (item, pragha_musicobject_get_track_no(mobj));
file = pragha_musicobject_get_file (mobj);
uri = g_filename_to_uri (file, NULL, NULL);
rygel_media_object_add_uri (RYGEL_MEDIA_OBJECT (item), uri);
g_free (uri);
rygel_audio_item_set_duration (RYGEL_AUDIO_ITEM(item), (glong)pragha_musicobject_get_length(mobj));
file = pragha_musicobject_get_file (mobj);
content_type = g_content_type_guess (file, NULL, 0, &uncertain);
rygel_media_item_set_mime_type (RYGEL_MEDIA_ITEM (item), content_type);
rygel_media_file_item_set_mime_type (RYGEL_MEDIA_FILE_ITEM (item), content_type);
g_free(content_type);
uri = g_filename_to_uri (file, NULL, NULL);
rygel_music_item_set_track_number (item, pragha_musicobject_get_track_no(mobj));
object = RYGEL_MEDIA_OBJECT (item);
gee_collection_add (GEE_COLLECTION (object->uris), uri);
g_free (uri);
rygel_audio_item_set_album (RYGEL_AUDIO_ITEM(item), pragha_musicobject_get_album(mobj));
rygel_audio_item_set_duration (RYGEL_AUDIO_ITEM(item), (glong)pragha_musicobject_get_length(mobj));
rygel_media_object_set_artist (RYGEL_MEDIA_OBJECT(item), pragha_musicobject_get_artist(mobj));
rygel_simple_container_add_child_item (priv->container, RYGEL_MEDIA_ITEM(item));
g_object_unref (item);
}
g_free(u_title);
......
/*************************************************************************/
/* Copyright (C) 2009-2013 matias <mati86dl@gmail.com> */
/* Copyright (C) 2009-2017 matias <mati86dl@gmail.com> */
/* */
/* 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,6 +24,7 @@
#include <gmodule.h>
#include <gtk/gtk.h>
#include <keybinder.h>
#include <gdk/gdkx.h>
#include <libpeas/peas.h>
#include <libpeas-gtk/peas-gtk.h>
......@@ -101,6 +102,9 @@ pragha_plugin_activate (PeasActivatable *activatable)
{
PraghaKeybinderPlugin *plugin = PRAGHA_KEYBINDER_PLUGIN (activatable);
if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
return;
PraghaKeybinderPluginPrivate *priv = plugin->priv;
priv->pragha = g_object_get_data (G_OBJECT (plugin), "object");
......@@ -120,9 +124,12 @@ pragha_plugin_deactivate (PeasActivatable *activatable)
{
CDEBUG(DBG_PLUGIN, "Keybinder plugin %s", G_STRFUNC);
if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
return;
keybinder_unbind("XF86AudioPlay", (KeybinderHandler) keybind_play_handler);
keybinder_unbind("XF86AudioStop", (KeybinderHandler) keybind_stop_handler);
keybinder_unbind("XF86AudioPrev", (KeybinderHandler) keybind_prev_handler);
keybinder_unbind("XF86AudioNext", (KeybinderHandler) keybind_next_handler);
keybinder_unbind("XF86AudioMedia", (KeybinderHandler) keybind_media_handler);
}
\ No newline at end of file
}
......@@ -591,6 +591,8 @@ pragha_lastfm_tags_corrected_dialog (GtkButton *button, PraghaLastfmPlugin *plug
}
dialog = pragha_tags_dialog_new();
gtk_window_set_transient_for (GTK_WINDOW(dialog),
GTK_WINDOW(pragha_application_get_window (priv->pragha)));
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (pragha_corrected_by_lastfm_dialog_response), plugin);
......@@ -601,27 +603,6 @@ pragha_lastfm_tags_corrected_dialog (GtkButton *button, PraghaLastfmPlugin *plug
gtk_widget_show (dialog);
}
void
pragha_lastfm_set_tiny_button (GtkWidget *button)
{
GtkCssProvider *provider;
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
"#tiny-button {\n"
" -GtkButton-default-border : 0px;\n"
" -GtkButton-default-outside-border : 0px;\n"
" -GtkButton-inner-border: 0px;\n"
" -GtkWidget-focus-line-width: 0px;\n"
" -GtkWidget-focus-padding: 0px;\n"
" padding: 1px;}",
-1, NULL);
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
gtk_widget_set_name (button, "tiny-button");
g_object_unref (provider);
}
static GtkWidget*
pragha_lastfm_tag_suggestion_button_new (PraghaLastfmPlugin *plugin)
{
......@@ -638,7 +619,7 @@ pragha_lastfm_tag_suggestion_button_new (PraghaLastfmPlugin *plugin)
g_signal_connect(G_OBJECT(ntag_lastfm_button), "clicked",
G_CALLBACK(pragha_lastfm_tags_corrected_dialog), plugin);
pragha_lastfm_set_tiny_button (ntag_lastfm_button);
pragha_hig_set_tiny_button (ntag_lastfm_button);
gtk_image_set_pixel_size (GTK_IMAGE(image), 12);
return ntag_lastfm_button;
......@@ -1817,7 +1798,6 @@ pragha_lastfm_plugin_append_setting (PraghaLastfmPlugin *plugin)
lastfm_pass = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY(lastfm_pass), LASTFM_PASS_LEN);
gtk_entry_set_visibility (GTK_ENTRY(lastfm_pass), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY(lastfm_pass), '*');
gtk_entry_set_activates_default (GTK_ENTRY(lastfm_pass), TRUE);
pragha_hig_workarea_table_add_row (table, &row, lastfm_plabel, lastfm_pass);
......
/*************************************************************************/
/* Copyright (C) 2009-2013 matias <mati86dl@gmail.com> */
/* Copyright (C) 2009-2017 matias <mati86dl@gmail.com> */
/* */
/* 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 */
......@@ -703,23 +703,26 @@ mpris_Player_get_MaximumRate (GError **error, PraghaMpris2Plugin *plugin)
static GVariant *
mpris_Player_get_CanGoNext (GError **error, PraghaMpris2Plugin *plugin)
{
// do we need to go into such detail?
return g_variant_new_boolean(TRUE);
return g_variant_new_boolean(pragha_playback_can_go_next(plugin->priv->pragha));
}
static GVariant *
mpris_Player_get_CanGoPrevious (GError **error, PraghaMpris2Plugin *plugin)
{
// do we need to go into such detail?
return g_variant_new_boolean(TRUE);
return g_variant_new_boolean(pragha_playback_can_go_prev(plugin->priv->pragha));
}
static GVariant *
mpris_Player_get_CanPlay (GError **error, PraghaMpris2Plugin *plugin)
{
PraghaBackend *backend = pragha_application_get_backend (plugin->priv->pragha);
PraghaBackend *backend;
gboolean can_play = FALSE;
return g_variant_new_boolean(pragha_backend_get_state (backend) == ST_PAUSED);
backend = pragha_application_get_backend (plugin->priv->pragha);
can_play = ((pragha_backend_get_state (backend) != ST_STOPPED) ||
(pragha_playback_get_no_tracks(plugin->priv->pragha) > 0));
return g_variant_new_boolean (can_play);
}
static GVariant *
......@@ -727,7 +730,7 @@ mpris_Player_get_CanPause (GError **error, PraghaMpris2Plugin *plugin)
{
PraghaBackend *backend = pragha_application_get_backend (plugin->priv->pragha);
return g_variant_new_boolean(pragha_backend_get_state (backend) == ST_PLAYING);
return g_variant_new_boolean(pragha_backend_get_state (backend) != ST_STOPPED);
}
static GVariant *
......@@ -850,7 +853,7 @@ static GVariant *
mpris_Playlists_get_ActivePlaylist (GError **error, PraghaMpris2Plugin *plugin)
{
return g_variant_new("(b(oss))",
FALSE, "/", _("Playlists"), _("Playlists"));
FALSE, "/", _("Tracks"), _("Tracks"));
/* Formally this is correct, but in the practice only is used to
display a confuse message "invalid" in the ubuntu-soundmenu.
......@@ -1212,59 +1215,104 @@ static void
pragha_mpris_update_any (PraghaMpris2Plugin *plugin)
{
PraghaBackend *backend;
PraghaBackendState playback_state = ST_STOPPED;
PraghaPreferences *preferences;
gboolean change_detected = FALSE, shuffle, repeat;
gboolean new_song = FALSE, change_detected = FALSE;
gboolean shuffle, repeat, can_next, can_prev, can_play, can_pause, can_seek;
GVariantBuilder b;
const gchar *newtitle = NULL;
const gchar *current_title = NULL;
gdouble curr_vol;
gint has_tracks = 0;
if(NULL == plugin->priv->dbus_connection)
return; /* better safe than sorry */
CDEBUG(DBG_PLUGIN, "MPRIS update any");
g_variant_builder_init(&b, G_VARIANT_TYPE("a{sv}"));
backend = pragha_application_get_backend (plugin->priv->pragha);
if (pragha_backend_get_state (backend) != ST_STOPPED) {
newtitle = pragha_musicobject_get_file (pragha_backend_get_musicobject (backend));
playback_state = pragha_backend_get_state (backend);
if (playback_state != ST_STOPPED) {
current_title = pragha_musicobject_get_file (pragha_backend_get_musicobject (backend));
}
g_variant_builder_init(&b, G_VARIANT_TYPE("a{sv}"));
if (g_strcmp0(plugin->priv->saved_title, current_title)) {
new_song = TRUE;
change_detected = TRUE;
if (plugin->priv->saved_title)
g_free(plugin->priv->saved_title);
if (string_is_not_empty(current_title))
plugin->priv->saved_title = g_strdup(current_title);
else
plugin->priv->saved_title = NULL;
g_variant_builder_add (&b, "{sv}", "Metadata", mpris_Player_get_Metadata (NULL, plugin));
}
preferences = pragha_application_get_preferences (plugin->priv->pragha);
shuffle = pragha_preferences_get_shuffle (preferences);
if (plugin->priv->saved_shuffle != shuffle) {
if (new_song || (plugin->priv->saved_shuffle != shuffle)) {
change_detected = TRUE;
plugin->priv->saved_shuffle = shuffle;
g_variant_builder_add (&b, "{sv}", "Shuffle", mpris_Player_get_Shuffle (NULL, plugin));
}
if (plugin->priv->state != pragha_backend_get_state (backend)) {
if (new_song || (plugin->priv->state != playback_state)) {
change_detected = TRUE;
plugin->priv->state = pragha_backend_get_state (backend);
plugin->priv->state = playback_state;
g_variant_builder_add (&b, "{sv}", "PlaybackStatus", mpris_Player_get_PlaybackStatus (NULL, plugin));
}
repeat = pragha_preferences_get_repeat (preferences);
if (plugin->priv->saved_playbackstatus != repeat) {
if (new_song || (plugin->priv->saved_playbackstatus != repeat)) {
change_detected = TRUE;
plugin->priv->saved_playbackstatus = repeat;
g_variant_builder_add (&b, "{sv}", "LoopStatus", mpris_Player_get_LoopStatus (NULL, plugin));
}
curr_vol = pragha_backend_get_volume (backend);
if (plugin->priv->volume != curr_vol) {
if (new_song || (plugin->priv->volume != curr_vol)) {
change_detected = TRUE;
plugin->priv->volume = curr_vol;
g_variant_builder_add (&b, "{sv}", "Volume", mpris_Player_get_Volume (NULL, plugin));
}
if (g_strcmp0(plugin->priv->saved_title, newtitle)) {
can_next = pragha_playback_can_go_next (plugin->priv->pragha);
if (new_song || (plugin->priv->saved_can_next != can_next)) {
change_detected = TRUE;
if(plugin->priv->saved_title)
g_free(plugin->priv->saved_title);
if(string_is_not_empty(newtitle))
plugin->priv->saved_title = g_strdup(newtitle);
else
plugin->priv->saved_title = NULL;
g_variant_builder_add (&b, "{sv}", "Metadata", mpris_Player_get_Metadata (NULL, plugin));
plugin->priv->saved_can_next = can_next;
g_variant_builder_add (&b, "{sv}", "CanGoNext", mpris_Player_get_CanGoNext (NULL, plugin));
}
can_prev = pragha_playback_can_go_prev (plugin->priv->pragha);
if (new_song || (plugin->priv->saved_can_prev != can_prev)) {
change_detected = TRUE;
plugin->priv->saved_can_prev = can_prev;
g_variant_builder_add (&b, "{sv}", "CanGoPrevious", mpris_Player_get_CanGoPrevious (NULL, plugin));
}
has_tracks = pragha_playback_get_no_tracks(plugin->priv->pragha);
can_play = (playback_state != ST_STOPPED) || has_tracks;
if (new_song || (plugin->priv->saved_can_play != can_play)) {
change_detected = TRUE;
plugin->priv->saved_can_play = can_play;
g_variant_builder_add (&b, "{sv}", "CanPlay", mpris_Player_get_CanPlay (NULL, plugin));
}
can_pause = (playback_state != ST_STOPPED);
if (new_song || (plugin->priv->saved_can_pause != can_pause)) {
change_detected = TRUE;
plugin->priv->saved_can_pause = can_pause;
g_variant_builder_add (&b, "{sv}", "CanPause", mpris_Player_get_CanPause (NULL, plugin));
}
can_seek = pragha_backend_can_seek (backend);
if (new_song || (plugin->priv->saved_can_seek != can_seek)) {
change_detected = TRUE;
plugin->priv->saved_can_seek = can_seek;
g_variant_builder_add (&b, "{sv}", "CanSeek", mpris_Player_get_CanSeek (NULL, plugin));
}
if (change_detected) {
......@@ -1438,6 +1486,14 @@ any_notify_cb (GObject *gobject, GParamSpec *pspec, gpointer user_data)
pragha_mpris_update_any (plugin);
}
static void
playlist_any_notify_cb (PraghaPlaylist *playlist, gpointer user_data)
{
PraghaMpris2Plugin *plugin = user_data;
pragha_mpris_update_any (plugin);
}
static void
pragha_art_cache_changed_handler (PraghaArtCache *cache, PraghaMpris2Plugin *plugin)
{
......@@ -1469,6 +1525,7 @@ pragha_plugin_activate (PeasActivatable *activatable)
{
PraghaPreferences *preferences;
PraghaBackend *backend;
PraghaPlaylist *playlist;
PraghaArtCache *art_cache;
PraghaMpris2Plugin *plugin = PRAGHA_MPRIS2_PLUGIN (activatable);
......@@ -1482,6 +1539,11 @@ pragha_plugin_activate (PeasActivatable *activatable)
priv->saved_playbackstatus = FALSE;
priv->saved_title = NULL;
priv->volume = 0;
priv->saved_can_next = FALSE;
priv->saved_can_prev = FALSE;
priv->saved_can_play = FALSE;
priv->saved_can_pause = FALSE;
priv->saved_can_seek = FALSE;
priv->introspection_data = g_dbus_node_info_new_for_xml (mpris2xml, NULL);
g_assert (priv->introspection_data != NULL);
......@@ -1504,6 +1566,10 @@ pragha_plugin_activate (PeasActivatable *activatable)
g_signal_connect (backend, "notify::state", G_CALLBACK (any_notify_cb), plugin);
g_signal_connect (backend, "seeked", G_CALLBACK (seeked_cb), plugin);
playlist = pragha_application_get_playlist (priv->pragha);
g_signal_connect (playlist, "playlist-changed",
G_CALLBACK(playlist_any_notify_cb), plugin);
art_cache = pragha_application_get_art_cache (priv->pragha);
g_signal_connect (art_cache, "cache-changed",
G_CALLBACK(pragha_art_cache_changed_handler), plugin);
......@@ -1513,7 +1579,9 @@ static void
pragha_plugin_deactivate (PeasActivatable *activatable)
{
PraghaBackend *backend;
PraghaPlaylist *playlist;
PraghaArtCache *art_cache;
PraghaPreferences *preferences;
gint i;
PraghaMpris2Plugin *plugin = PRAGHA_MPRIS2_PLUGIN (activatable);
......@@ -1529,10 +1597,16 @@ pragha_plugin_deactivate (PeasActivatable *activatable)
priv->registration_object_ids[i]);
}
preferences = pragha_application_get_preferences (priv->pragha);
g_signal_handlers_disconnect_by_func (preferences, any_notify_cb, plugin);
backend = pragha_application_get_backend (priv->pragha);
g_signal_handlers_disconnect_by_func (backend, seeked_cb, plugin);
g_signal_handlers_disconnect_by_func (backend, any_notify_cb, plugin);
playlist = pragha_application_get_playlist (priv->pragha);
g_signal_handlers_disconnect_by_func (playlist, playlist_any_notify_cb, plugin);
art_cache = pragha_application_get_art_cache (priv->pragha);
g_signal_handlers_disconnect_by_func (art_cache, pragha_art_cache_changed_handler, plugin);
......
/*************************************************************************/
/* Copyright (C) 2009-2013 matias <mati86dl@gmail.com> */
/* Copyright (C) 2009-2017 matias <mati86dl@gmail.com> */
/* */
/* 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 */
......@@ -51,6 +51,12 @@ struct _PraghaMpris2PluginPrivate {
gboolean saved_shuffle;
gchar *saved_title;
gdouble volume;
gboolean saved_can_next;
gboolean saved_can_prev;
gboolean saved_can_play;
gboolean saved_can_pause;
gboolean saved_can_seek;
PraghaBackendState state;
};
......
......@@ -63,8 +63,8 @@ typedef struct _PraghaMtpPluginPrivate PraghaMtpPluginPrivate;
struct _PraghaMtpPluginPrivate {
PraghaApplication *pragha;
guint64 bus_hooked;
guint64 device_hooked;
gint bus_hooked;
gint device_hooked;
GUdevDevice *u_device;
LIBMTP_mtpdevice_t *mtp_device;
......@@ -214,6 +214,97 @@ pragha_mtp_cache_insert_track (PraghaMtpPlugin *plugin, PraghaMusicobject *mobj)
mobj);
}
static void
pragha_mtp_plugin_cache_storage_recursive (LIBMTP_mtpdevice_t *device,
guint storageid,
gint leaf,