Author: jannis Date: 2008-06-22 12:09:04 +0000 (Sun, 22 Jun 2008) New Revision: 27130
Modified: xfce4-mixer/trunk/ChangeLog xfce4-mixer/trunk/TODO xfce4-mixer/trunk/panel-plugin/xfce-volume-button.c Log: * panel-plugin/xfce-volume-button.c: Preload icon pixbufs whenever the icon size is changed. Modified: xfce4-mixer/trunk/ChangeLog =================================================================== --- xfce4-mixer/trunk/ChangeLog 2008-06-22 10:57:49 UTC (rev 27129) +++ xfce4-mixer/trunk/ChangeLog 2008-06-22 12:09:04 UTC (rev 27130) @@ -1,5 +1,10 @@ 2008-06-22 Jannis Pohlmann <[EMAIL PROTECTED]> + * panel-plugin/xfce-volume-button.c: Preload icon pixbufs whenever + the icon size is changed. + +2008-06-22 Jannis Pohlmann <[EMAIL PROTECTED]> + * xfce4-mixer/xfce-mixer.c: Don't free the hash table keys as they are owned by GStreamer. That introduced a really, really weird bug ... Modified: xfce4-mixer/trunk/TODO =================================================================== --- xfce4-mixer/trunk/TODO 2008-06-22 10:57:49 UTC (rev 27129) +++ xfce4-mixer/trunk/TODO 2008-06-22 12:09:04 UTC (rev 27130) @@ -1,7 +1,9 @@ -* Monitor for changes and update the controls according to them: - 1) Add GHashTable for (track name => mixer widget) lookup - 2) Extend xfce_mixer_bus_message() to handle all types of messages - by updating the corresponding mixer widgets +* Design new icons for the mixer plugin +* Panel plugin: Decide on how to react on tracks with + different channel volume levels (median, minimum, maximum value?) + +* Panel plugin: Add volume percentage tooltip + * Allow changing controls from the console, probably via something like: --change-control=SOUNDCARD NAME:TRACK NAME:NEW VALUE Modified: xfce4-mixer/trunk/panel-plugin/xfce-volume-button.c =================================================================== --- xfce4-mixer/trunk/panel-plugin/xfce-volume-button.c 2008-06-22 10:57:49 UTC (rev 27129) +++ xfce4-mixer/trunk/panel-plugin/xfce-volume-button.c 2008-06-22 12:09:04 UTC (rev 27130) @@ -22,6 +22,7 @@ #include <config.h> #endif +#include <gdk/gdk.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> @@ -98,13 +99,15 @@ { GtkButton __parent__; - GtkWidget *image; + GtkWidget *image; - GtkObject *adjustment; + GtkObject *adjustment; - gint icon_size; + gint icon_size; - gboolean is_muted; + GdkPixbuf **pixbufs; + + gboolean is_muted; }; @@ -187,6 +190,8 @@ { button->is_muted = FALSE; + button->pixbufs = g_new0 (GdkPixbuf*, G_N_ELEMENTS (icons)-1); + button->adjustment = gtk_adjustment_new (0.0, 0.0, 1.0, 0.05, 0.05, 0.2); button->image = xfce_scaled_image_new (); @@ -220,8 +225,16 @@ static void xfce_volume_button_finalize (GObject *object) { + gint i; + XfceVolumeButton *button = XFCE_VOLUME_BUTTON (object); + for (i = 0; i < G_N_ELEMENTS (icons)-1; ++i) + if (GDK_IS_PIXBUF (button->pixbufs[i])) + g_object_unref (G_OBJECT (button->pixbufs[i])); + + g_free (button->pixbufs); + (*G_OBJECT_CLASS (xfce_volume_button_parent_class)->finalize) (object); } @@ -368,22 +381,19 @@ range = (upper - lower) / (G_N_ELEMENTS (icons) - 2); if (G_UNLIKELY (value == 0 || button->is_muted)) - pixbuf = xfce_themed_icon_load (icons[0], button->icon_size); + pixbuf = button->pixbufs[0]; else { for (i = 1; i < G_N_ELEMENTS (icons) - 1; ++i) if (value <= range * i) { - pixbuf = xfce_themed_icon_load (icons[i], button->icon_size); + pixbuf = button->pixbufs[i]; break; } } if (G_LIKELY (pixbuf != NULL)) - { - xfce_scaled_image_set_from_pixbuf (XFCE_SCALED_IMAGE (button->image), pixbuf); - g_object_unref (G_OBJECT (pixbuf)); - } + xfce_scaled_image_set_from_pixbuf (XFCE_SCALED_IMAGE (button->image), pixbuf); } @@ -421,9 +431,20 @@ xfce_volume_button_set_icon_size (XfceVolumeButton *button, gint size) { + gint i; + g_return_if_fail (IS_XFCE_VOLUME_BUTTON (button)); g_return_if_fail (size >= 0); + button->icon_size = size; + + for (i = 0; i < G_N_ELEMENTS (icons)-1; ++i) + { + if (GDK_IS_PIXBUF (button->pixbufs[i])) + g_object_unref (G_OBJECT (button->pixbufs[i])); + + button->pixbufs[i] = xfce_themed_icon_load (icons[i], button->icon_size); + } } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits