rpms/dalston/devel 0001-Update-to-latest-gnome-volume-control-code.patch, NONE, 1.1 dalston.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Peter Robinson pbrobinson at fedoraproject.org
Thu Oct 8 06:05:15 UTC 2009


Author: pbrobinson

Update of /cvs/pkgs/rpms/dalston/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5338/devel

Modified Files:
	.cvsignore sources 
Added Files:
	0001-Update-to-latest-gnome-volume-control-code.patch 
	dalston.spec import.log 
Log Message:
- Initial import


0001-Update-to-latest-gnome-volume-control-code.patch:
 dalston/dalston-volume-applet.c  |   58 ---
 dalston/dalston-volume-slider.c  |    3 
 libgvc/Makefile.am               |    2 
 libgvc/gvc-channel-map.c         |  185 +++++++++--
 libgvc/gvc-channel-map.h         |   24 +
 libgvc/gvc-mixer-card.c          |  498 +++++++++++++++++++++++++++++
 libgvc/gvc-mixer-card.h          |   86 +++++
 libgvc/gvc-mixer-control.c       |  650 ++++++++++++++++++++++++++++++++++-----
 libgvc/gvc-mixer-control.h       |   11 
 libgvc/gvc-mixer-event-role.c    |   29 -
 libgvc/gvc-mixer-event-role.h    |    5 
 libgvc/gvc-mixer-sink-input.c    |   40 +-
 libgvc/gvc-mixer-sink.c          |   85 +++--
 libgvc/gvc-mixer-source-output.c |    6 
 libgvc/gvc-mixer-source.c        |   80 +++-
 libgvc/gvc-mixer-stream.c        |  289 +++++++++++++++--
 libgvc/gvc-mixer-stream.h        |   35 +-
 tests/test-gvc.c                 |    5 
 18 files changed, 1790 insertions(+), 301 deletions(-)

--- NEW FILE 0001-Update-to-latest-gnome-volume-control-code.patch ---
>From ade5203a152ec2a9445db0511f23823f86ae3843 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Thu, 17 Sep 2009 19:00:33 +0100
Subject: [PATCH] Update to latest gnome-volume-control code

---
 dalston/dalston-volume-applet.c  |   58 +----
 dalston/dalston-volume-slider.c  |    3 +-
 libgvc/Makefile.am               |    2 +
 libgvc/gvc-channel-map.c         |  185 +++++++++--
 libgvc/gvc-channel-map.h         |   24 ++-
 libgvc/gvc-mixer-card.c          |  498 +++++++++++++++++++++++++++++
 libgvc/gvc-mixer-card.h          |   86 +++++
 libgvc/gvc-mixer-control.c       |  650 +++++++++++++++++++++++++++++++++-----
 libgvc/gvc-mixer-control.h       |   11 +-
 libgvc/gvc-mixer-event-role.c    |   29 +-
 libgvc/gvc-mixer-event-role.h    |    5 +-
 libgvc/gvc-mixer-sink-input.c    |   40 ++--
 libgvc/gvc-mixer-sink.c          |   85 ++++--
 libgvc/gvc-mixer-source-output.c |    6 +-
 libgvc/gvc-mixer-source.c        |   80 ++++--
 libgvc/gvc-mixer-stream.c        |  289 +++++++++++++++--
 libgvc/gvc-mixer-stream.h        |   35 ++-
 tests/test-gvc.c                 |    4 +-
 18 files changed, 1790 insertions(+), 300 deletions(-)
 create mode 100644 libgvc/gvc-mixer-card.c
 create mode 100644 libgvc/gvc-mixer-card.h

diff --git a/dalston/dalston-volume-applet.c b/dalston/dalston-volume-applet.c
index f8ac1f2..d79c1ce 100644
--- a/dalston/dalston-volume-applet.c
+++ b/dalston/dalston-volume-applet.c
@@ -229,17 +229,6 @@ dalston_volume_applet_update_default_sink (DalstonVolumeApplet  *self,
   }
 }
 
-static gboolean
-_reopen_pa_timeout_cb (gpointer data)
-{
-  DalstonVolumeAppletPrivate *priv = GET_PRIVATE (data);
-
-  priv->timeout = 0;
-  gvc_mixer_control_open (priv->control);
-  return FALSE;
-}
-
-
 static void
 _mixer_control_default_sink_changed_cb (GvcMixerControl *control,
                                         guint            id,
@@ -249,54 +238,13 @@ _mixer_control_default_sink_changed_cb (GvcMixerControl *control,
 }
 
 static void
-_mixer_control_connection_failed_cb (GvcMixerControl *control,
-                                     gpointer         userdata)
-{
-  DalstonVolumeAppletPrivate *priv = GET_PRIVATE (userdata);
-
-  g_signal_handlers_disconnect_by_func (priv->control,
-                                        _mixer_control_default_sink_changed_cb,
-                                        userdata);
-  g_signal_handlers_disconnect_by_func (priv->control,
-                                        _mixer_control_ready_cb,
-                                        userdata);
-  g_signal_handlers_disconnect_by_func (priv->control,
-                                        _mixer_control_connection_failed_cb,
-                                        userdata);
-
-  priv->control = gvc_mixer_control_new ();
-  g_signal_connect (priv->control,
-                    "default-sink-changed",
-                    (GCallback)_mixer_control_default_sink_changed_cb,
-                    userdata);
-  g_signal_connect (priv->control,
-                    "ready",
-                    (GCallback)_mixer_control_ready_cb,
-                    userdata);
-  g_signal_connect (priv->control,
-                    "connection-failed",
-                    (GCallback)_mixer_control_connection_failed_cb,
-                    userdata);
-
-  if (priv->timeout)
-  {
-      g_source_remove (priv->timeout);
-      priv->timeout = 0;
-  }
-
-  priv->timeout = g_timeout_add (10000,
-                                 _reopen_pa_timeout_cb,
-                                 userdata);
-}
-
-static void
 dalston_volume_applet_init (DalstonVolumeApplet *self)
 {
   DalstonVolumeAppletPrivate *priv = GET_PRIVATE (self);
 
   priv->pane = dalston_volume_pane_new ();
 
-  priv->control = gvc_mixer_control_new ();
+  priv->control = gvc_mixer_control_new ("Dalston Moblin Volume Control");
   dalston_volume_applet_update_default_sink (self, priv->control);
   g_signal_connect (priv->control,
                     "default-sink-changed",
@@ -306,10 +254,6 @@ dalston_volume_applet_init (DalstonVolumeApplet *self)
                     "ready",
                     (GCallback)_mixer_control_ready_cb,
                     self);
-  g_signal_connect (priv->control,
-                    "connection-failed",
-                    (GCallback)_mixer_control_connection_failed_cb,
-                    self);
   gvc_mixer_control_open (priv->control);
 }
 
diff --git a/dalston/dalston-volume-slider.c b/dalston/dalston-volume-slider.c
index 54067e8..2f686e1 100644
--- a/dalston/dalston-volume-slider.c
+++ b/dalston/dalston-volume-slider.c
@@ -205,7 +205,8 @@ _range_value_changed_cb (DalstonVolumeSlider *slider,
   volume = (float)gtk_range_get_value (GTK_RANGE (slider)) / 100.0 * PA_VOLUME_NORM;
   gtk_range_set_fill_level (GTK_RANGE (slider),
                             gtk_range_get_value (GTK_RANGE (slider)));
-  gvc_mixer_stream_change_volume (priv->sink, volume);
+  if (gvc_mixer_stream_set_volume (priv->sink, volume) != FALSE)
+    gvc_mixer_stream_push_volume (priv->sink);
   g_signal_handlers_unblock_by_func (priv->sink,
                                      _stream_volume_notify_cb,
                                      slider);
diff --git a/libgvc/Makefile.am b/libgvc/Makefile.am
index 10832ae..65aee36 100644
--- a/libgvc/Makefile.am
+++ b/libgvc/Makefile.am
@@ -4,6 +4,8 @@ libgvc_la_CFLAGS = $(PULSE_CFLAGS) \
 libgvc_la_LIBADD = $(PULSE_LIBS) $(GLIB_LIBS)
 libgvc_la_SOURCES = gvc-channel-map.c  \
 		    gvc-channel-map.h  \
+		    gvc-mixer-card.c \
+		    gvc-mixer-card.h \
 		    gvc-mixer-control.c \
 		    gvc-mixer-control.h \
 		    gvc-mixer-event-role.c \
diff --git a/libgvc/gvc-channel-map.c b/libgvc/gvc-channel-map.c
index b8a0791..ea3e5af 100644
--- a/libgvc/gvc-channel-map.c
+++ b/libgvc/gvc-channel-map.c
@@ -33,16 +33,27 @@
 
 #define GVC_CHANNEL_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMapPrivate))
 
+#ifndef PA_CHECK_VERSION
+#define PA_CHECK_VERSION(major,minor,micro)                             \
+        ((PA_MAJOR > (major)) ||                                        \
+         (PA_MAJOR == (major) && PA_MINOR > (minor)) ||                 \
+         (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro)))
+#endif
+
+
 struct GvcChannelMapPrivate
 {
-        guint                 num_channels;
-        pa_channel_position_t positions[PA_CHANNELS_MAX];
-        gdouble               gains[PA_CHANNELS_MAX];
+        pa_channel_map        pa_map;
+        gboolean              pa_volume_is_set;
+        pa_cvolume            pa_volume;
+        gdouble               extern_volume[NUM_TYPES]; /* volume, balance, fade, lfe */
         gboolean              can_balance;
+        gboolean              can_fade;
+        gboolean              has_lfe;
 };
 
 enum {
-        GAINS_CHANGED,
+        VOLUME_CHANGED,
         LAST_SIGNAL
 };
 
@@ -54,32 +65,135 @@ static void     gvc_channel_map_finalize   (GObject            *object);
 
 G_DEFINE_TYPE (GvcChannelMap, gvc_channel_map, G_TYPE_OBJECT)
 
+/* FIXME remove when we depend on a newer PA */
+static int
+gvc_pa_channel_map_has_position (const pa_channel_map *map, pa_channel_position_t p) {
+        unsigned c;
+
+        g_return_val_if_fail(pa_channel_map_valid(map), 0);
+        g_return_val_if_fail(p < PA_CHANNEL_POSITION_MAX, 0);
+
+        for (c = 0; c < map->channels; c++)
+                if (map->map[c] == p)
+                        return 1;
+
+        return 0;
+}
+
[...2798 lines suppressed...]
 
+gboolean
+gvc_mixer_stream_is_running (GvcMixerStream *stream)
+{
+        if (stream->priv->change_volume_op == NULL)
+                return FALSE;
+
+        if ((pa_operation_get_state(stream->priv->change_volume_op) == PA_OPERATION_RUNNING))
+                return TRUE;
+
+        pa_operation_unref(stream->priv->change_volume_op);
+        stream->priv->change_volume_op = NULL;
+
+        return FALSE;
+}
+
 static void
 gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
 {
@@ -510,7 +706,8 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
         gobject_class->set_property = gvc_mixer_stream_set_property;
         gobject_class->get_property = gvc_mixer_stream_get_property;
 
-        klass->change_volume = gvc_mixer_stream_real_change_volume;
+        klass->push_volume = gvc_mixer_stream_real_push_volume;
+        klass->change_port = gvc_mixer_stream_real_change_port;
         klass->change_is_muted = gvc_mixer_stream_real_change_is_muted;
 
         g_object_class_install_property (gobject_class,
@@ -546,7 +743,7 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
                                                              "Volume",
                                                              "The volume for this stream",
                                                              0, G_MAXULONG, 0,
-                                                             G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+                                                             G_PARAM_READWRITE));
         g_object_class_install_property (gobject_class,
                                          PROP_DECIBEL,
                                          g_param_spec_double ("decibel",
@@ -604,6 +801,20 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
                                                                "Whether stream's role is to play an event",
                                                                FALSE,
                                                                G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+        g_object_class_install_property (gobject_class,
+                                         PROP_IS_VIRTUAL,
+                                         g_param_spec_boolean ("is-virtual",
+                                                               "is virtual stream",
+                                                               "Whether the stream is virtual",
+                                                               FALSE,
+                                                               G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+        g_object_class_install_property (gobject_class,
+                                         PROP_PORT,
+                                         g_param_spec_string ("port",
+                                                              "Port",
+                                                              "The name of the current port for this stream",
+                                                              NULL,
+                                                              G_PARAM_READWRITE));
         g_type_class_add_private (klass, sizeof (GvcMixerStreamPrivate));
 }
 
@@ -611,7 +822,14 @@ static void
 gvc_mixer_stream_init (GvcMixerStream *stream)
 {
         stream->priv = GVC_MIXER_STREAM_GET_PRIVATE (stream);
+}
 
+static void
+free_port (GvcMixerStreamPort *p)
+{
+        g_free (p->port);
+        g_free (p->human_port);
+        g_free (p);
 }
 
 static void
@@ -638,5 +856,20 @@ gvc_mixer_stream_finalize (GObject *object)
         g_free (mixer_stream->priv->icon_name);
         mixer_stream->priv->icon_name = NULL;
 
+        g_free (mixer_stream->priv->port);
+        mixer_stream->priv->port = NULL;
+
+        g_free (mixer_stream->priv->human_port);
+        mixer_stream->priv->human_port = NULL;
+
+        g_list_foreach (mixer_stream->priv->ports, (GFunc) free_port, NULL);
+        g_list_free (mixer_stream->priv->ports);
+        mixer_stream->priv->ports = NULL;
+
+       if (mixer_stream->priv->change_volume_op) {
+               pa_operation_unref(mixer_stream->priv->change_volume_op);
+               mixer_stream->priv->change_volume_op = NULL;
+       }
+
         G_OBJECT_CLASS (gvc_mixer_stream_parent_class)->finalize (object);
 }
diff --git a/libgvc/gvc-mixer-stream.h b/libgvc/gvc-mixer-stream.h
index 2848146..4ae2d34 100644
--- a/libgvc/gvc-mixer-stream.h
+++ b/libgvc/gvc-mixer-stream.h
@@ -48,37 +48,52 @@ typedef struct
         GObjectClass           parent_class;
 
         /* vtable */
-        gboolean (*change_volume)   (GvcMixerStream *stream,
-                                     guint           volume);
+        gboolean (*push_volume)     (GvcMixerStream *stream,
+                                     gpointer *operation);
         gboolean (*change_is_muted) (GvcMixerStream *stream,
                                      gboolean        is_muted);
+        gboolean (*change_port)     (GvcMixerStream *stream,
+                                     const char     *port);
 } GvcMixerStreamClass;
 
+typedef struct
+{
+        char *port;
+        char *human_port;
+        guint priority;
+} GvcMixerStreamPort;
+
 GType               gvc_mixer_stream_get_type        (void);
 
 pa_context *        gvc_mixer_stream_get_pa_context  (GvcMixerStream *stream);
 guint               gvc_mixer_stream_get_index       (GvcMixerStream *stream);
 guint               gvc_mixer_stream_get_id          (GvcMixerStream *stream);
 GvcChannelMap *     gvc_mixer_stream_get_channel_map (GvcMixerStream *stream);
+GvcMixerStreamPort *gvc_mixer_stream_get_port        (GvcMixerStream *stream);
+const GList *       gvc_mixer_stream_get_ports       (GvcMixerStream *stream);
+gboolean            gvc_mixer_stream_change_port     (GvcMixerStream *stream,
+                                                      const char     *port);
 
-guint               gvc_mixer_stream_get_volume      (GvcMixerStream *stream);
+pa_volume_t         gvc_mixer_stream_get_volume      (GvcMixerStream *stream);
 gdouble             gvc_mixer_stream_get_decibel     (GvcMixerStream *stream);
-gboolean            gvc_mixer_stream_change_volume   (GvcMixerStream *stream,
-                                                      guint           volume);
+gboolean            gvc_mixer_stream_push_volume     (GvcMixerStream *stream);
+pa_volume_t         gvc_mixer_stream_get_base_volume (GvcMixerStream *stream);
 
 gboolean            gvc_mixer_stream_get_is_muted    (GvcMixerStream *stream);
 gboolean            gvc_mixer_stream_get_can_decibel (GvcMixerStream *stream);
 gboolean            gvc_mixer_stream_change_is_muted (GvcMixerStream *stream,
                                                       gboolean        is_muted);
+gboolean            gvc_mixer_stream_is_running      (GvcMixerStream *stream);
 const char *        gvc_mixer_stream_get_name        (GvcMixerStream *stream);
 const char *        gvc_mixer_stream_get_icon_name   (GvcMixerStream *stream);
 const char *        gvc_mixer_stream_get_description (GvcMixerStream *stream);
 const char *        gvc_mixer_stream_get_application_id (GvcMixerStream *stream);
 gboolean            gvc_mixer_stream_is_event_stream (GvcMixerStream *stream);
+gboolean            gvc_mixer_stream_is_virtual      (GvcMixerStream *stream);
 
 /* private */
 gboolean            gvc_mixer_stream_set_volume      (GvcMixerStream *stream,
-                                                      guint           volume);
+                                                      pa_volume_t     volume);
 gboolean            gvc_mixer_stream_set_decibel     (GvcMixerStream *stream,
                                                       gdouble         db);
 gboolean            gvc_mixer_stream_set_is_muted    (GvcMixerStream *stream,
@@ -93,8 +108,16 @@ gboolean            gvc_mixer_stream_set_icon_name   (GvcMixerStream *stream,
                                                       const char     *name);
 gboolean            gvc_mixer_stream_set_is_event_stream (GvcMixerStream *stream,
                                                           gboolean is_event_stream);
+gboolean            gvc_mixer_stream_set_is_virtual  (GvcMixerStream *stream,
+                                                      gboolean is_event_stream);
 gboolean            gvc_mixer_stream_set_application_id (GvcMixerStream *stream,
                                                          const char *application_id);
+gboolean            gvc_mixer_stream_set_base_volume (GvcMixerStream *stream,
+                                                      pa_volume_t     base_volume);
+gboolean            gvc_mixer_stream_set_port        (GvcMixerStream *stream,
+                                                      const char     *port);
+gboolean            gvc_mixer_stream_set_ports       (GvcMixerStream *stream,
+                                                      GList          *ports);
 
 G_END_DECLS
 
diff --git a/tests/test-gvc.c b/tests/test-gvc.c
index 855d428..4f2a6e1 100644
--- a/tests/test-gvc.c
+++ b/tests/test-gvc.c
@@ -47,7 +47,7 @@ _mixer_control_default_sink_changed_cb (GvcMixerControl *control,
   app->default_sink = gvc_mixer_control_get_default_sink (app->control);
   g_signal_connect (app->default_sink,
                     "notify::volume",
-                    _stream_volume_notify_cb,
+                    G_CALLBACK (_stream_volume_notify_cb),
                     app);
 }
 
@@ -68,7 +68,7 @@ main (int    argc,
   g_type_init ();
 
   app = g_new0 (GvcTestApp, 1);
-  app->control = gvc_mixer_control_new ();
+  app->control = gvc_mixer_control_new ("Dalston Volume Test Application");
   g_signal_connect (app->control,
                     "default-sink-changed",
                     _mixer_control_default_sink_changed_cb,
-- 
1.6.2.5



--- NEW FILE dalston.spec ---
# Creation of the tarball as follows:
# wget http://git.moblin.org/cgit.cgi/%{name}/snapshot/%{name}-%{version}.tar.bz2
# tar xf %{name}-%{version}.tar.bz2
# cd %{name}-%{version}
# patch -p1 dalston-nbtk-1.2.patch
# patch -p1 0001-Update-to-latest-gnome-volume-control-code.patch
# make dist

Name:          dalston
Version:       0.1.8
Release:       1%{?dist}
Summary:       Moblin System Information Icons

Group:         System Environment/Libraries
License:       LGPLv2 and GPLv2+
URL:           http://www.moblin.org/
Source0:       %{name}-%{version}.tar.gz
# Patches are applied during creation of 'make dist' tarball above. Are included here for reference
Patch0:        0001-Update-to-latest-gnome-volume-control-code.patch
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: dbus-glib-devel
BuildRequires: GConf2-devel
BuildRequires: gtk2-devel
BuildRequires: pulseaudio-libs-devel
BuildRequires: libcanberra-devel
BuildRequires: mutter-moblin-devel
BuildRequires: nbtk-devel
BuildRequires: libnotify-devel
BuildRequires: pkgconfig
BuildRequires: intltool
BuildRequires: gettext

%description
System information icons for Moblin including volume and power 
management applets.

%prep
%setup -q

%build
%configure --disable-static
make %{?_smp_mflags} V=1

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALL='install -p'

%find_lang %{name}

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING README
%{_sysconfdir}/xdg/autostart/*
%{_bindir}/dalston-power-applet
%{_bindir}/dalston-volume-applet
%{_datadir}/dalston

%changelog
* Tue Oct  6 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.8-1
- new upstream 0.1.8 release

* Sat Oct  3 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.6-3
- make dist tarball creation

* Sun Sep 27 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.6-2
- Add patch from upstream for nbtk-1.2 and latest g-v-c

* Mon Sep 14 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.6-1
- new upstream 0.1.6 release, review updates

* Wed Sep  9 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.5-1
- new upstream 0.1.5 release

* Tue Aug 27 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.2-1
- new upstream 0.1.2 release

* Wed Aug 26 2009 Peter Robinson <pbrobinson at gmail.com> 0.1.0-1
- new upstream 0.1.0 release

* Tue Aug 11 2009 Peter Robinson <pbrobinson at gmail.com> 0.0.29-2
- Updates from review request

* Sun Jul 26 2009 Peter Robinson <pbrobinson at gmail.com> 0.0.29-1
- New 0.0.29 upstream release

* Mon Jul  6 2009 Peter Robinson <pbrobinson at gmail.com> 0.0.27-1
- New 0.0.27 upstream release, updates from initial review

* Thu Jun 18 2009 Peter Robinson <pbrobinson at gmail.com> 0.0.25-1
- Initial packaging


--- NEW FILE import.log ---
dalston-0_1_8-1_fc11:HEAD:dalston-0.1.8-1.fc11.src.rpm:1254981861


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/dalston/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- .cvsignore	8 Oct 2009 05:59:32 -0000	1.1
+++ .cvsignore	8 Oct 2009 06:05:14 -0000	1.2
@@ -0,0 +1 @@
+dalston-0.1.8.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/dalston/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- sources	8 Oct 2009 05:59:33 -0000	1.1
+++ sources	8 Oct 2009 06:05:15 -0000	1.2
@@ -0,0 +1 @@
+62e097ec92f2ed09110ccbf6cdadfa3a  dalston-0.1.8.tar.gz




More information about the fedora-extras-commits mailing list