← Back to team overview

audio-recorder team mailing list archive

[Merge] lp:~osmoma/audio-recorder/trunk into lp:audio-recorder

 

moma has proposed merging lp:~osmoma/audio-recorder/trunk into lp:audio-recorder.

Commit message:
dbus-mpris.c: MPRIS2 'Metdata' is not necessary if 'PlaybackStatus'=='Playing'. Missing 'Metadata' is actually an error but the recorder can survive without it.

Requested reviews:
  Team audio-recorder (audio-recorder)

For more details, see:
https://code.launchpad.net/~osmoma/audio-recorder/trunk/+merge/255215

Small changes in dbus-mpris.c.

-- 
Your team Team audio-recorder is requested to review the proposed merge of lp:~osmoma/audio-recorder/trunk into lp:audio-recorder.
=== modified file 'src/audio-sources.c'
--- src/audio-sources.c	2015-02-06 14:13:34 +0000
+++ src/audio-sources.c	2015-04-03 21:13:03 +0000
@@ -687,7 +687,7 @@
         GdkPixbuf *pixbuf = NULL;
         if (item->type == MEDIA_PLAYER || item->type == COMM_PROGRAM) {
 
-            pixbuf = load_icon_pixbuf((gchar*)p);
+            pixbuf = load_icon_pixbuf((gchar*)p, 22);
 
             // Got icon??
             if (!GDK_IS_PIXBUF(pixbuf)) {

=== modified file 'src/dbus-mpris2.c'
--- src/dbus-mpris2.c	2015-02-06 14:13:34 +0000
+++ src/dbus-mpris2.c	2015-04-03 21:13:03 +0000
@@ -3,10 +3,7 @@
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License (GPL3), or any later version.
- *
- * This library is distributed in the hope that it will be useful,
+ * License as published by the Free Software Foundation; either"OK
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Library General Public License 3 for more details.
@@ -573,6 +570,20 @@
     return res;
 }
 
+#if 0
+void debug_variant(const gchar *tag, GVariant *v) {
+    if (!v) {
+        g_print("%s is NULL.\n", tag);
+        return;
+    }
+
+    gchar *sval = g_variant_print(v, TRUE);
+    const gchar *stype = g_variant_get_type_string(v);
+    g_print("%s has type:%s and value:%s\n", tag, stype, sval);
+    g_free(sval);
+}
+#endif
+
 void mpris2_get_metadata(gpointer player_rec) {
     // Get track information (=metadata) and state for the given media player.
     // Ref: http://www.mpris.org/2.1/spec/Player_Node.html#Property:Metadata
@@ -602,6 +613,8 @@
     //
     GVariant *result = mpris2_get_player_value(player, "PlaybackStatus");
 
+    // DEBUG: debug_variant("PlaybackStatus", result);
+
     if (!result) {
         // Cannot contact player (it has quit)?
         tr->status = PLAYER_STATUS_CLOSED;
@@ -657,9 +670,14 @@
     //
     GVariant *dict = mpris2_get_player_value(player, "Metadata");
 
+    // DEBUG: debug_variant("Metadata", dict);
+
     if (!dict) {
-        // Cannot contact player (it has quit)?
-        tr->status = PLAYER_STATUS_CLOSED;
+        // Cannot get Metadata (should we consider this as on error?)
+        // 03.april.2015, commented out by MOma:  Ambient Noise Player does not support "Metadata" yet.  
+
+        // tr->status = PLAYER_STATUS_CLOSED;
+
         return;
     }
 

=== modified file 'src/settings.c'
--- src/settings.c	2015-02-10 20:45:27 +0000
+++ src/settings.c	2015-04-03 21:13:03 +0000
@@ -354,7 +354,7 @@
         case COMM_PROGRAM:
             descr = g_strdup(item->description);
 
-            pixbuf = load_icon_pixbuf(item->icon_name);
+            pixbuf = load_icon_pixbuf(item->icon_name, 22);
 
             // Translators: This is a label/help text in the [Additional settings] dialog
             help_text = g_strdup(_("Select both output device (speakers) and webcam/microphone."));

=== modified file 'src/systray-icon.c'
--- src/systray-icon.c	2015-02-06 14:13:34 +0000
+++ src/systray-icon.c	2015-04-03 21:13:03 +0000
@@ -101,7 +101,7 @@
 static void systray_popup_menu_cb(GtkWidget * widget, gpointer data) {
     gchar *cmd = (gchar*)data;
 
-    LOG_SYSTRAY("%s: systray_popup_menu_cb: %s\n", INSTALLED_INDICATOR_TYPE, cmd);
+    LOG_SYSTRAY("systray_popup_menu_cb: %s\n", cmd);
 
     if (!g_strcmp0(cmd, "start")) {
         rec_manager_flip_recording();

=== modified file 'src/utility.c'
--- src/utility.c	2015-02-06 14:13:34 +0000
+++ src/utility.c	2015-04-03 21:13:03 +0000
@@ -923,7 +923,7 @@
     return value;
 }
 
-GdkPixbuf *load_icon_pixbuf(gchar *icon_name) {
+GdkPixbuf *load_icon_pixbuf(gchar *icon_name, guint _size) {
     // Load icon pixbuf from current icon theme.
     GdkPixbuf *pixbuf = NULL;
 
@@ -935,11 +935,11 @@
     GtkIconTheme *theme = gtk_icon_theme_get_default();
 
     // Load icon from its theme
-    pixbuf = gtk_icon_theme_load_icon(theme, icon_name, 22, 0, NULL);
+    pixbuf = gtk_icon_theme_load_icon(theme, icon_name, _size, 0, NULL);
 
     // Got it?
     if (GDK_IS_PIXBUF(pixbuf)) {
-        return pixbuf;
+        goto LBL_1;
     }
 
     // Executable name != icon_name.
@@ -969,13 +969,22 @@
 
     if (icon_n) {
         // Load icon
-        pixbuf = gtk_icon_theme_load_icon(theme, icon_n, 22, 0, NULL);
+        pixbuf = gtk_icon_theme_load_icon(theme, icon_n, _size, 0, NULL);
     }
 
     g_free(icon_n);
     g_free(desktop_file);
     g_object_unref(app_info);
 
+LBL_1:
+
+    // Some icons are large. Force to _size.
+    if (GDK_IS_PIXBUF(pixbuf)) {
+        GdkPixbuf *img = gdk_pixbuf_scale_simple(pixbuf, _size, _size, GDK_INTERP_HYPER);
+        g_object_unref(pixbuf);
+        pixbuf = img;
+    }
+
     // Caller should g_object_unref() this value
     return pixbuf;
 }

=== modified file 'src/utility.h'
--- src/utility.h	2014-10-27 17:16:32 +0000
+++ src/utility.h	2015-04-03 21:13:03 +0000
@@ -74,7 +74,7 @@
 gboolean str_lists_equal(GList *l1, GList *l2);
 
 gchar *read_value_from_keyfile(gchar *key_file, gchar *group_name, gchar *key_name);
-GdkPixbuf *load_icon_pixbuf(gchar *icon_name);
+GdkPixbuf *load_icon_pixbuf(gchar *icon_name, guint _size);
 
 void kill_frozen_instances(gchar *program_path, GPid preserve_pid);
 void kill_program_by_name(gchar *app_name, GPid preserve_pid);