gnome-applets r11223 - in trunk: . mixer null_applet po



Author: callum
Date: Tue Jan 27 00:46:19 2009
New Revision: 11223
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=11223&view=rev

Log:
The mixer applet returns.

Added:
   trunk/mixer/
      - copied from r11174, /trunk/mixer/
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.in
   trunk/mixer/ChangeLog
   trunk/mixer/applet.c
   trunk/mixer/load.c
   trunk/mixer/preferences.c
   trunk/null_applet/ChangeLog
   trunk/null_applet/Makefile.am
   trunk/po/POTFILES.in

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Tue Jan 27 00:46:19 2009
@@ -37,6 +37,10 @@
 invest_applet_SUBDIR = invest-applet
 endif
 
+if BUILD_MIXER_APPLET
+mixer_applet_SUBDIR = mixer
+endif
+
 always_built_SUBDIRS =  \
 	charpick	\
 	drivemount	\
@@ -58,7 +62,8 @@
 	$(accessx_status_SUBDIR)\
 	$(keyboard_applet_SUBDIRS)	\
 	$(invest_applet_SUBDIR)	\
-	$(cpufreq_SUBDIR)
+	$(cpufreq_SUBDIR) \
+	$(mixer_applet_SUBDIR)
 
 DIST_SUBDIRS = \
 	po		\
@@ -78,6 +83,7 @@
 	trashapplet	\
 	cpufreq		\
 	invest-applet	\
+	mixer 		\
 	null_applet
 
 EXTRA_DIST = \

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Jan 27 00:46:19 2009
@@ -35,6 +35,7 @@
 GUCHARMAP_REQUIRED=1.4.0
 POLKIT_REQUIRED=0.7
 NETWORKMANAGER_REQUIRED=0.7
+GST10_REQUIRED=0.10.2
 dnl ***************************************************************************
 
 AM_MAINTAINER_MODE
@@ -320,6 +321,25 @@
 AC_SUBST(NETWORKMANAGER_CFLAGS)
 AC_SUBST(NETWORKMANAGER_LIBS)
 
+dnl -- check for the Mixer ----------------------------------------------------
+AC_ARG_ENABLE([mixer-applet],
+    AC_HELP_STRING([--enable-mixer-applet], [Enable the gstreamer-based mixer applet.]),
+    enable_mixer=$enableval,
+    enable_mixer=no)
+if test "x$enable_mixer" != "xno"; then
+    MIXER_CFLAGS=
+    MIXER_LIBS=
+    GST10_PKGS="gstreamer-0.10 >= $GST10_REQUIRED gstreamer-plugins-base-0.10 >= $GST10_REQUIRED"
+    PKG_CHECK_MODULES(MIXER, $GST10_PKGS, HAVE_GST=yes, HAVE_GST=no)
+    if test "x$HAVE_GST" = "xno"; then
+        enable_mixer=no
+        AC_MSG_ERROR([Mixer applet explicitly requested but a compatible gstreamer version was not found])
+    fi
+fi
+AM_CONDITIONAL(BUILD_MIXER_APPLET, test "x$enable_mixer" = "xyes")
+AC_SUBST(MIXER_CFLAGS)
+AC_SUBST(MIXER_LIBS)
+
 dnl ***************************************************************************
 dnl *** find paths to installed binaries                                    ***
 dnl ***************************************************************************
@@ -769,11 +789,12 @@
 		- enabling suid bit	$suid
 	 - drivemount			always
 	 - geyes			always
-	 - keyboard-applet		$BUILD_KEYBOARD_APPLET
 	 - gweather			$build_libgweather_applets
 	 - invest-applet		$BUILD_INVEST_APPLET
+	 - keyboard-applet		$BUILD_KEYBOARD_APPLET
 	 - mini-commander		$enable_mini_commander
 	 - modemlights			$BUILD_MODEM_LIGHTS
+	 - mixer			$enable_mixer
 	 - multiload			$build_gtop_applets
 	 - stickynotes			$enable_stickynotes
 	 - trashapplet			always

Modified: trunk/mixer/applet.c
==============================================================================
--- /trunk/mixer/applet.c	(original)
+++ trunk/mixer/applet.c	Tue Jan 27 00:46:19 2009
@@ -253,12 +253,8 @@
   active_track_name_list = NULL;
 
   if (reset_state) {
-#ifdef HAVE_GST10
     gst_element_set_state (element, GST_STATE_READY);
     if (gst_element_get_state(element, NULL, NULL, -1) != GST_STATE_CHANGE_SUCCESS)
-#else
-    if (gst_element_set_state (element, GST_STATE_READY) != GST_STATE_SUCCESS)
-#endif
       return NULL;
   }
 
@@ -1314,12 +1310,8 @@
 
           if (new_element != old_element) {
             /* change element */
-#ifdef HAVE_GST10
             gst_element_set_state (item->data, GST_STATE_READY);
             if (gst_element_get_state (item->data, NULL, NULL, -1) != GST_STATE_CHANGE_SUCCESS)
-#else
-            if (gst_element_set_state (item->data, GST_STATE_READY) != GST_STATE_SUCCESS)
-#endif
               continue;
 	    
             /* save */
@@ -1411,11 +1403,7 @@
 
     char *comments = g_strdup_printf ("%s\n\n%s",
 		    _("Volume control for your GNOME Panel."),
-#ifdef HAVE_GST10
 		    _("Using GStreamer 0.10.")
-#else
-		    _("Using GStreamer 0.8.")
-#endif
 		    );
 
     gtk_show_about_dialog (NULL,

Modified: trunk/mixer/load.c
==============================================================================
--- /trunk/mixer/load.c	(original)
+++ trunk/mixer/load.c	Tue Jan 27 00:46:19 2009
@@ -26,15 +26,10 @@
 #include <string.h>
 
 #include <glib.h>
-#ifdef HAVE_GST10
 #include <gst/audio/mixerutils.h>
-#else
-#include <gst/propertyprobe/propertyprobe.h>
-#endif
 
 #include "applet.h"
 
-#ifdef HAVE_GST10
 typedef struct _FilterHelper {
    GList *names_list;
    gint count;
@@ -132,166 +127,6 @@
    return mixer_list;
 }
 
-#else /* HAVE GST 0.8 */
-static gint
-sort_by_rank (GstElement * a, GstElement * b)
-{
-#define gst_element_rank(x) \
-  gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE ( \
-      gst_element_get_factory (x)))
-  return gst_element_rank (b) - gst_element_rank (a);
-}
-
-/*
- * Probe for mixer elements. Set up GList * with elements,
- * where each element has a GObject data node set of the
- * name "gnome-volume-control-name" with the value being
- * the human-readable name of the element.
- *
- * All elements in the returned GList * are in state
- * GST_STATE_NULL.
- */
-
-static GList *
-create_mixer_collection (void)
-{
-  const GList *elements, *item;
-  GList *collection = NULL;
-  gint num = 0;
-
-  /* go through all elements of a certain class and check whether
-   * they implement a mixer. If so, add it to the list. */
-  elements = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
-  for ( ; elements != NULL; elements = elements->next) {
-    GstElementFactory *factory = GST_ELEMENT_FACTORY (elements->data);
-    gchar *title = NULL, *name;
-    const gchar *klass;
-    GstElement *element = NULL;
-    const GParamSpec *devspec;
-    GstPropertyProbe *probe;
-    GValueArray *array = NULL;
-    gint n, samenamenr;
-
-    /* check category */
-    klass = gst_element_factory_get_klass (factory);
-    if (strcmp (klass, "Generic/Audio"))
-      goto next;
-
-    /* FIXME:
-     * - maybe we want to rename the element to its actual name
-     *     if we've found that?
-     */
-#define _label N_("Unknown Volume Control %d")
-
-    /* create element */
-    title = g_strdup_printf (gettext("Unknown Volume Control %d"), num);
-    element = gst_element_factory_create (factory, title);
-    if (!element)
-      goto next;
-
-    if (!GST_IS_PROPERTY_PROBE (element))
-      goto next;
-
-    probe = GST_PROPERTY_PROBE (element);
-    if (!(devspec = gst_property_probe_get_property (probe, "device")))
-      goto next;
-    if (!(array = gst_property_probe_probe_and_get_values (probe, devspec)))
-      goto next;
-
-    /* set all devices and test for mixer */
-    for (n = 0; n < array->n_values; n++) {
-      GValue *device = g_value_array_get_nth (array, n);
-
-      /* set this device */
-      g_object_set_property (G_OBJECT (element), "device", device);
-      if (gst_element_set_state (element,
-				 GST_STATE_READY) == GST_STATE_FAILURE)
-        continue;
-
-      /* is this device a mixer? */
-      if (!GST_IS_MIXER (element)) {
-        gst_element_set_state (element, GST_STATE_NULL);
-        continue;
-      }
-
-      /* any tracks? */
-      if (!gst_mixer_list_tracks (GST_MIXER (element))) {
-        gst_element_set_state (element, GST_STATE_NULL);
-        continue;
-      }
-
-      /* fetch name */
-      if (g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (element)),
-					"device-name")) {
-        gchar *devname;
-        g_object_get (element, "device-name", &devname, NULL);
-        name = g_strdup_printf ("%s (%s)", devname,
-				gst_element_factory_get_longname (factory));
-      } else {
-        name = g_strdup_printf ("%s (%s)", title,
-				gst_element_factory_get_longname (factory));
-      }
-
-      /* there may be devices with the same name, and since we sort based
-       * on unique names, we need to make sure they really are. */
-      samenamenr = 0;
-      for (item = collection; item != NULL; item = item->next) {
-        const gchar *tname;
-
-        tname = g_object_get_data (G_OBJECT (item->data),
-				   "gnome-volume-applet-origname");
-        if (!strcmp (tname, name)) {
-          samenamenr++;
-        }
-      }
-      if (samenamenr) {
-        gchar *tname;
-
-        /* name already exists, so append a number to make it unique */
-        tname = g_strdup_printf ("%s #%d", name, samenamenr + 1);
-
-        g_object_set_data_full (G_OBJECT (element),
-                                "gnome-volume-applet-origname",
-                                name, (GDestroyNotify) g_free);
-
-        g_object_set_data_full (G_OBJECT (element),
-                                "gnome-volume-applet-name",
-                                tname, (GDestroyNotify) g_free);
-      } else {
-        g_object_set_data_full (G_OBJECT (element),
-                                "gnome-volume-applet-origname",
-                                g_strdup (name), (GDestroyNotify) g_free);
-
-        g_object_set_data_full (G_OBJECT (element),
-                                "gnome-volume-applet-name",
-                                name, (GDestroyNotify) g_free);
-      }
-
-      name = NULL; /* passed ownership to object in _set_data_full above */
-
-      /* add to list */
-      gst_element_set_state (element, GST_STATE_NULL);
-      collection = g_list_append (collection, element);
-      num++;
-
-      /* and recreate this object, since we give it to the mixer */
-      g_free (title);
-      title = g_strdup_printf (gettext("Unknown Volume Control %d"), num);
-      element = gst_element_factory_create (factory, title);
-    }
-
-next:
-    if (element)
-      gst_object_unref (GST_OBJECT (element));
-    if (array)
-      g_value_array_free (array);
-    g_free (title);
-  }
-
-  return g_list_sort (collection, (GCompareFunc) sort_by_rank);
-}
-#endif
-
 static gboolean
 gnome_volume_applet_toplevel_configure_handler (GtkWidget *widget,
 						GdkEventConfigure *event,

Modified: trunk/mixer/preferences.c
==============================================================================
--- /trunk/mixer/preferences.c	(original)
+++ trunk/mixer/preferences.c	Tue Jan 27 00:46:19 2009
@@ -30,11 +30,7 @@
 
 #include <gtk/gtk.h>
 
-#ifdef HAVE_GST10
 #include <gst/interfaces/mixer.h>
-#else
-#include <gst/mixer/mixer.h>
-#endif
 
 #include "applet.h"
 #include "preferences.h"

Modified: trunk/null_applet/Makefile.am
==============================================================================
--- trunk/null_applet/Makefile.am	(original)
+++ trunk/null_applet/Makefile.am	Tue Jan 27 00:46:19 2009
@@ -3,6 +3,11 @@
 	-I$(srcdir)		\
 	$(GNOME_APPLETS_CFLAGS)
 
+## The null applet takes over if the mixer isn't built.
+if !BUILD_MIXER_APPLET
+mixer_server_in = GNOME_MixerApplet.server.in
+endif
+
 libexec_PROGRAMS = null_applet
 
 null_applet_SOURCES = null_applet.c
@@ -15,7 +20,7 @@
 	GNOME_CDPlayerApplet.server.in		\
 	GNOME_MailcheckApplet_Factory.server.in	\
 	GNOME_Panel_WirelessApplet.server.in	\
-	GNOME_MixerApplet.server.in
+	$(mixer_server_in)
 server_DATA = $(server_in_files:.server.in=.server)
 
 @INTLTOOL_SERVER_RULE@
@@ -25,6 +30,8 @@
 
 CLEANFILES = GNOME_NullApplet_Factory.server.in $(server_DATA)
 
+## Note that the mixer applet server.in file is always distributed, but
+## note always used.
 EXTRA_DIST =					\
 	GNOME_NullApplet_Factory.server.in.in	\
 	GNOME_CDPlayerApplet.server.in		\

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Tue Jan 27 00:46:19 2009
@@ -80,6 +80,13 @@
 mini-commander/src/mini-commander.schemas.in
 mini-commander/src/mini-commander_applet.c
 mini-commander/src/preferences.c
+mixer/GNOME_MixerApplet.server.in.in
+mixer/GNOME_MixerApplet.xml
+mixer/applet.c
+mixer/dock.c
+mixer/load.c
+mixer/mixer.schemas.in
+mixer/preferences.c
 modemlights/GNOME_ModemLights.server.in.in
 modemlights/GNOME_ModemLights.xml
 modemlights/modem-applet.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]