Fix possible memory leak from previous commit: don't create widgets before alsa inited.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 22 Nov 2014 13:57:43 +0000 (15:57 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 22 Nov 2014 13:57:43 +0000 (15:57 +0200)
AUTHORS
ChangeLog
plugins/volumealsa/volumealsa.c

diff --git a/AUTHORS b/AUTHORS
index ddf5c87..c97ec8c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -14,6 +14,7 @@ LXPanel - Lightweight X11 desktop panel
     Giuseppe Penone <giuspen@gmail.com>
     Piotr Sipika <piotr.sipika@gmail.com>
     Raimar B├╝hmann <raimar@buehmann.de>
+    Peter <ombalaxitabou@users.sf.net>
 
 [History]
 LXPanel is a derivative work from fbpanel [1] written by Anatoly Asviyan,
index 842f3af..1e08c3f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -67,6 +67,8 @@
 * Implemented sorting plugins in Add plugin window in alphabetic order.
 * Fixed font in the weather plugin to use panel settings.
 * Added new API lxpanel_button_compose() for future usage by plugins.
+* Added optional volumealsa plugin volume mapping from alsamixer (patch
+    from Peter).
 
 0.7.2
 -------------------------------------------------------------------------
index c285d54..fa80f45 100644 (file)
@@ -627,16 +627,8 @@ static GtkWidget *volumealsa_constructor(LXPanel *panel, config_setting_t *setti
     VolumeALSAPlugin * vol = g_new0(VolumeALSAPlugin, 1);
     GtkWidget *p;
 
-    /* Allocate top level widget and set into Plugin widget pointer. */
-    vol->panel = panel;
-    vol->plugin = p = gtk_event_box_new();
-    vol->settings = settings;
-    lxpanel_plugin_set_data(p, vol, volumealsa_destructor);
-    gtk_widget_add_events(p, GDK_BUTTON_PRESS_MASK);
-    gtk_widget_set_tooltip_text(p, _("Volume control"));
-
     /* Read config necessary for proper initialization of ALSA. */
-    config_setting_lookup_int(vol->settings, "UseAlsamixerVolumeMapping", &vol->alsamixer_mapping);
+    config_setting_lookup_int(settings, "UseAlsamixerVolumeMapping", &vol->alsamixer_mapping);
 
     /* Initialize ALSA.  If that fails, present nothing. */
     if ( ! asound_initialize(vol))
@@ -645,6 +637,14 @@ static GtkWidget *volumealsa_constructor(LXPanel *panel, config_setting_t *setti
         return NULL;
     }
 
+    /* Allocate top level widget and set into Plugin widget pointer. */
+    vol->panel = panel;
+    vol->plugin = p = gtk_event_box_new();
+    vol->settings = settings;
+    lxpanel_plugin_set_data(p, vol, volumealsa_destructor);
+    gtk_widget_add_events(p, GDK_BUTTON_PRESS_MASK);
+    gtk_widget_set_tooltip_text(p, _("Volume control"));
+
     /* Allocate icon as a child of top level. */
     vol->tray_icon = lxpanel_image_new_for_icon(panel, "audio-volume-muted-panel",
                                                 -1, ICONS_MUTE);