Re: Committing a patch to gnome-2-2 branch of gnome-applets (adds astring)
- From: Balamurali Viswanathan <balamurali viswanathan wipro com>
- To: Kevin Vandersloot <kfv101 psu edu>, release-team gnome org
- Cc: GNOME-i18n <gnome-i18n gnome org>
- Subject: Re: Committing a patch to gnome-2-2 branch of gnome-applets (adds astring)
- Date: Wed, 26 Mar 2003 22:02:24 +0530
Hi Kevin,Murray
Appologies for that. Marked it for translation and committed to HEAD.
Attaching the patch with the string marked for translation.
Thanks,
Bala
Kevin Vandersloot wrote:
>
> Hi Bala. You need to mark the string for translation. Did you mark the
> string on the HEAD branch also?
>
> To the i18n/release team: this would add one string change to the
> gnome-2-2 branch.
>
> Regards,
> Kevin
>
> On Wed, 2003-03-26 at 10:53, Balamurali Viswanathan wrote:
> > Hi All,
> > Have a patch for the following bug
> > http://bugzilla.gnome.org/show_bug.cgi?id=105296
> > which has been committed to the HEAD branch of gnome-applets. I would
> > like to commit it to gnome-2-2 branch as well.
> >
> > Attaching the patch. Kindly Please let me know whether I can go ahead.
> >
> > Thanks and Regards,
> > Bala
> > ----
> >
>
> > Index: gnome-applets//cdplayer/cdplayer.c
> > ===================================================================
> > RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/cdplayer.c,v
> > retrieving revision 1.94
> > diff -p -u -5 -r1.94 cdplayer.c
> > --- gnome-applets//cdplayer/cdplayer.c 2003/03/07 00:30:36 1.94
> > +++ gnome-applets//cdplayer/cdplayer.c 2003/03/20 14:45:38
> > @@ -818,10 +818,11 @@ static void
> > cdplayer_play_pause(GtkWidget * w, gpointer data)
> > {
> > CDPlayerData *cd = data;
> > cdrom_device_status_t stat;
> > int status;
> > + int ret;
> >
> > if(!cd_try_open(cd))
> > return;
> >
> > status = cdrom_get_status(cd->cdrom_device, &stat);
> > @@ -838,19 +839,36 @@ cdplayer_play_pause(GtkWidget * w, gpoin
> > case DISC_COMPLETED:
> > case DISC_STOP:
> > cdplayer_update_play_pause_button (cd, PAUSE_IMAGE);
> > case DISC_ERROR:
> > cdrom_read_track_info(cd->cdrom_device);
> > - cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
> > + ret = cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
> > cd->cdrom_device->track1);
> > break;
> > }
> > } else if(status == DISC_TRAY_OPEN) {
> > cdrom_load(cd->cdrom_device);
> > cdrom_read_track_info(cd->cdrom_device);
> > - cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
> > + ret = cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
> > cd->cdrom_device->track1);
> > + }
> > +
> > + if (ret == DISC_DEVICE_BUSY) {
> > + GtkWidget *dialog;
> > + dialog = gtk_message_dialog_new (NULL,
> > + GTK_DIALOG_DESTROY_WITH_PARENT,
> > + GTK_MESSAGE_ERROR,
> > + GTK_BUTTONS_CLOSE,
> > + "Audio Device is busy, or being used by another application",
> > + NULL);
> > + gtk_window_set_screen (GTK_WINDOW (dialog),
> > + gtk_widget_get_screen (cd->panel.applet));
> > + g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
> > + G_CALLBACK (gtk_widget_destroy),
> > + GTK_OBJECT (dialog));
> > +
> > + gtk_widget_show_all (dialog);
> > }
> > }
> >
> > static void
> > cdplayer_stop(GtkWidget * w, gpointer data)
> > Index: gnome-applets//cdplayer/cdrom-interface.h
> > ===================================================================
> > RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/cdrom-interface.h,v
> > retrieving revision 1.9
> > diff -p -u -5 -r1.9 cdrom-interface.h
> > --- gnome-applets//cdplayer/cdrom-interface.h 2002/12/02 02:27:44 1.9
> > +++ gnome-applets//cdplayer/cdrom-interface.h 2003/03/20 14:45:38
> > @@ -12,11 +12,12 @@ enum {
> > enum {
> > DISC_NO_ERROR = 0,
> > DISC_IO_ERROR,
> > DISC_INDEX_OUT_OF_RANGE,
> > DISC_TRAY_OPEN,
> > - DISC_DRIVE_NOT_READY
> > + DISC_DRIVE_NOT_READY,
> > + DISC_DEVICE_BUSY
> > };
> >
> > enum {
> > DISC_PLAY,
> > DISC_PAUSED,
> > Index: gnome-applets//cdplayer/cdrom-solaris.c
> > ===================================================================
> > RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/cdrom-solaris.c,v
> > retrieving revision 1.6
> > diff -p -u -5 -r1.6 cdrom-solaris.c
> > --- gnome-applets//cdplayer/cdrom-solaris.c 2002/07/12 00:27:52 1.6
> > +++ gnome-applets//cdplayer/cdrom-solaris.c 2003/03/20 14:45:38
> > @@ -22,17 +22,20 @@ int
> > cdrom_play(cdrom_device_t cdp, int start, int stop)
> > {
> > struct cdrom_ti ti;
> > struct cdrom_msf msf;
> > int start_lba, end_lba;
> > + int ret;
> >
> > /* If CDDA convert addresses to LBA format */
> > if (cdp->cdda) {
> > start_lba = msf2lba(&cdp->track_info[start - 1]);
> > end_lba = msf2lba(&cdp->track_info[stop]);
> > audio_stop(cdp->cdda);
> > - audio_start(cdp->cdda, start_lba, end_lba);
> > + ret = audio_start(cdp->cdda, start_lba, end_lba);
> > + if (ret == -1)
> > + return DISC_DEVICE_BUSY;
> > return (DISC_NO_ERROR);
> > }
> >
> > /* Set up CDROMPLAYMSF call. If this fails try CDROMPLAYTRKIND */
> > msf.cdmsf_min0 = cdp->track_info[start-1].address.minute;
> > Index: gnome-applets//cdplayer/writer-solaris.c
> > ===================================================================
> > RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/writer-solaris.c,v
> > retrieving revision 1.2
> > diff -p -u -5 -r1.2 writer-solaris.c
> > --- gnome-applets//cdplayer/writer-solaris.c 2002/07/16 14:24:47 1.2
> > +++ gnome-applets//cdplayer/writer-solaris.c 2003/03/20 14:45:39
> > @@ -5,17 +5,18 @@
> > */
> >
> > #include "cdda-solaris.h"
> > #include "reader-solaris.h"
> > #include "writer-solaris.h"
> > +#include <errno.h>
> >
> > /* Private function prototypes */
> > static void audio_get_info(cdda_t *, audio_info_t *);
> > static void audio_set_info(cdda_t *, audio_info_t *);
> > static void audio_flush(cdda_t *);
> > static void audio_drain(cdda_t *);
> > -static void cdda_audio_open(cdda_t *);
> > +static int cdda_audio_open(cdda_t *);
> > static void cdda_audio_close(cdda_t *);
> > static void audio_config(cdda_t *);
> > static int audio_supports_analog(cdda_t *);
> > static void audio_write_chunk(cdda_t *, char *);
> > static void audio_write_eof(cdda_t *);
> > @@ -144,25 +145,30 @@ audio_drain(cdda_t *cdda)
> > *
> > * Arguments:
> > * cdda_t *cdda Ptr to cdda state structure
> > *
> > * Returns:
> > - * void
> > + * int: The error number if open fails
> > */
> > -static void
> > +static int
> > cdda_audio_open(cdda_t *cdda)
> > {
> > + extern int errno;
> > + errno = 0;
> > /* Return if already open */
> > if (cdda->audio >= 0) {
> > - return;
> > + return errno;
> > }
> >
> > /* Open audio device */
> > - if ((cdda->audio = open(cdda->audio_device, O_WRONLY)) < 0) {
> > + if ((cdda->audio = open(cdda->audio_device, O_WRONLY | O_NDELAY)) < 0) {
> > perror("open()");
> > + return errno;
> > }
> >
> > + fcntl (cdda->audio, F_SETFL, O_WRONLY);
> > + return errno;
> > } /* cdda_audio_open() */
> >
> >
> > /*
> > * cdda_audio_close()
> > @@ -601,18 +607,19 @@ audio_get_state(cdda_t *cdda, struct cdr
> > * cdda_t *cdda Ptr to cdda state structure
> > * int start_lba Start play address
> > * int end_lba End play address
> > *
> > * Returns:
> > - * void
> > + * int: -1 for failure and 1 for sucess
> > */
> > -void
> > +int
> > audio_start(cdda_t *cdda, int start_lba, int end_lba)
> > {
> > + int errno;
> > /* If playing do nothing */
> > if (cdda->state != CDDA_STOPPED) {
> > - return;
> > + return 1;
> > }
> >
> > /* Initialise */
> > cdda->start_lba = start_lba;
> > cdda->end_lba = end_lba;
> > @@ -621,11 +628,13 @@ audio_start(cdda_t *cdda, int start_lba,
> > cdda->cdb.occupied = 0;
> > cdda->cdb.nextin = 0;
> > cdda->cdb.nextout = 0;
> >
> > /* Open the audio device */
> > - cdda_audio_open(cdda);
> > + errno = cdda_audio_open(cdda);
> > + if (cdda->audio < 0 && errno == EBUSY)
> > + return -1;
> >
> > /* Configure for CD audio */
> > audio_config(cdda);
> >
> > /* Fill buffers */
> > @@ -646,10 +655,11 @@ audio_start(cdda_t *cdda, int start_lba,
> > (void *)cdda) < 0) {
> > perror("pthread_create()");
> > exit(EXIT_FAILURE);
> > }
> >
> > + return 1;
> > } /* audio_start() */
> >
> >
> > /*
> > * cdda_cleanup()
> > Index: gnome-applets//cdplayer/writer-solaris.h
> > ===================================================================
> > RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/writer-solaris.h,v
> > retrieving revision 1.1
> > diff -p -u -5 -r1.1 writer-solaris.h
> > --- gnome-applets//cdplayer/writer-solaris.h 2002/07/12 00:27:52 1.1
> > +++ gnome-applets//cdplayer/writer-solaris.h 2003/03/20 14:45:39
> > @@ -3,11 +3,11 @@
> > */
> > #ifndef __WRITER_SOLARIS_H__
> > #define __WRITER_SOLARIS_H__
> >
> > /* Exported function prototypes */
> > -void audio_start(cdda_t *, int, int);
> > +int audio_start(cdda_t *, int, int);
> > void audio_pause(cdda_t *);
> > void audio_resume(cdda_t *);
> > void audio_stop(cdda_t *);
> > int audio_get_state(cdda_t *, struct cdrom_subchnl *);
> > void cdda_check(void **, int);
> >
> > ----
> >
>
> > **************************Disclaimer**************************************************
> >
> > Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged'
> > and 'confidential' and intended for use only by the individual or entity to which it is
> > addressed. You are notified that any use, copying or dissemination of the information
> > contained in the E-MAIL in any manner whatsoever is strictly prohibited.
> >
> > ****************************************************************************************
Index: gnome-applets//cdplayer/cdplayer.c
===================================================================
RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/cdplayer.c,v
retrieving revision 1.94
diff -p -u -5 -r1.94 cdplayer.c
--- gnome-applets//cdplayer/cdplayer.c 2003/03/07 00:30:36 1.94
+++ gnome-applets//cdplayer/cdplayer.c 2003/03/20 14:45:38
@@ -818,10 +818,11 @@ static void
cdplayer_play_pause(GtkWidget * w, gpointer data)
{
CDPlayerData *cd = data;
cdrom_device_status_t stat;
int status;
+ int ret;
if(!cd_try_open(cd))
return;
status = cdrom_get_status(cd->cdrom_device, &stat);
@@ -838,19 +839,36 @@ cdplayer_play_pause(GtkWidget * w, gpoin
case DISC_COMPLETED:
case DISC_STOP:
cdplayer_update_play_pause_button (cd, PAUSE_IMAGE);
case DISC_ERROR:
cdrom_read_track_info(cd->cdrom_device);
- cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
+ ret = cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
cd->cdrom_device->track1);
break;
}
} else if(status == DISC_TRAY_OPEN) {
cdrom_load(cd->cdrom_device);
cdrom_read_track_info(cd->cdrom_device);
- cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
+ ret = cdrom_play(cd->cdrom_device, cd->cdrom_device->track0,
cd->cdrom_device->track1);
+ }
+
+ if (ret == DISC_DEVICE_BUSY) {
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Audio Device is busy, or being used by another application"),
+ NULL);
+ gtk_window_set_screen (GTK_WINDOW (dialog),
+ gtk_widget_get_screen (cd->panel.applet));
+ g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
+ G_CALLBACK (gtk_widget_destroy),
+ GTK_OBJECT (dialog));
+
+ gtk_widget_show_all (dialog);
}
}
static void
cdplayer_stop(GtkWidget * w, gpointer data)
Index: gnome-applets//cdplayer/cdrom-interface.h
===================================================================
RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/cdrom-interface.h,v
retrieving revision 1.9
diff -p -u -5 -r1.9 cdrom-interface.h
--- gnome-applets//cdplayer/cdrom-interface.h 2002/12/02 02:27:44 1.9
+++ gnome-applets//cdplayer/cdrom-interface.h 2003/03/20 14:45:38
@@ -12,11 +12,12 @@ enum {
enum {
DISC_NO_ERROR = 0,
DISC_IO_ERROR,
DISC_INDEX_OUT_OF_RANGE,
DISC_TRAY_OPEN,
- DISC_DRIVE_NOT_READY
+ DISC_DRIVE_NOT_READY,
+ DISC_DEVICE_BUSY
};
enum {
DISC_PLAY,
DISC_PAUSED,
Index: gnome-applets//cdplayer/cdrom-solaris.c
===================================================================
RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/cdrom-solaris.c,v
retrieving revision 1.6
diff -p -u -5 -r1.6 cdrom-solaris.c
--- gnome-applets//cdplayer/cdrom-solaris.c 2002/07/12 00:27:52 1.6
+++ gnome-applets//cdplayer/cdrom-solaris.c 2003/03/20 14:45:38
@@ -22,17 +22,20 @@ int
cdrom_play(cdrom_device_t cdp, int start, int stop)
{
struct cdrom_ti ti;
struct cdrom_msf msf;
int start_lba, end_lba;
+ int ret;
/* If CDDA convert addresses to LBA format */
if (cdp->cdda) {
start_lba = msf2lba(&cdp->track_info[start - 1]);
end_lba = msf2lba(&cdp->track_info[stop]);
audio_stop(cdp->cdda);
- audio_start(cdp->cdda, start_lba, end_lba);
+ ret = audio_start(cdp->cdda, start_lba, end_lba);
+ if (ret == -1)
+ return DISC_DEVICE_BUSY;
return (DISC_NO_ERROR);
}
/* Set up CDROMPLAYMSF call. If this fails try CDROMPLAYTRKIND */
msf.cdmsf_min0 = cdp->track_info[start-1].address.minute;
Index: gnome-applets//cdplayer/writer-solaris.c
===================================================================
RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/writer-solaris.c,v
retrieving revision 1.2
diff -p -u -5 -r1.2 writer-solaris.c
--- gnome-applets//cdplayer/writer-solaris.c 2002/07/16 14:24:47 1.2
+++ gnome-applets//cdplayer/writer-solaris.c 2003/03/20 14:45:39
@@ -5,17 +5,18 @@
*/
#include "cdda-solaris.h"
#include "reader-solaris.h"
#include "writer-solaris.h"
+#include <errno.h>
/* Private function prototypes */
static void audio_get_info(cdda_t *, audio_info_t *);
static void audio_set_info(cdda_t *, audio_info_t *);
static void audio_flush(cdda_t *);
static void audio_drain(cdda_t *);
-static void cdda_audio_open(cdda_t *);
+static int cdda_audio_open(cdda_t *);
static void cdda_audio_close(cdda_t *);
static void audio_config(cdda_t *);
static int audio_supports_analog(cdda_t *);
static void audio_write_chunk(cdda_t *, char *);
static void audio_write_eof(cdda_t *);
@@ -144,25 +145,30 @@ audio_drain(cdda_t *cdda)
*
* Arguments:
* cdda_t *cdda Ptr to cdda state structure
*
* Returns:
- * void
+ * int: The error number if open fails
*/
-static void
+static int
cdda_audio_open(cdda_t *cdda)
{
+ extern int errno;
+ errno = 0;
/* Return if already open */
if (cdda->audio >= 0) {
- return;
+ return errno;
}
/* Open audio device */
- if ((cdda->audio = open(cdda->audio_device, O_WRONLY)) < 0) {
+ if ((cdda->audio = open(cdda->audio_device, O_WRONLY | O_NDELAY)) < 0) {
perror("open()");
+ return errno;
}
+ fcntl (cdda->audio, F_SETFL, O_WRONLY);
+ return errno;
} /* cdda_audio_open() */
/*
* cdda_audio_close()
@@ -601,18 +607,19 @@ audio_get_state(cdda_t *cdda, struct cdr
* cdda_t *cdda Ptr to cdda state structure
* int start_lba Start play address
* int end_lba End play address
*
* Returns:
- * void
+ * int: -1 for failure and 1 for sucess
*/
-void
+int
audio_start(cdda_t *cdda, int start_lba, int end_lba)
{
+ int errno;
/* If playing do nothing */
if (cdda->state != CDDA_STOPPED) {
- return;
+ return 1;
}
/* Initialise */
cdda->start_lba = start_lba;
cdda->end_lba = end_lba;
@@ -621,11 +628,13 @@ audio_start(cdda_t *cdda, int start_lba,
cdda->cdb.occupied = 0;
cdda->cdb.nextin = 0;
cdda->cdb.nextout = 0;
/* Open the audio device */
- cdda_audio_open(cdda);
+ errno = cdda_audio_open(cdda);
+ if (cdda->audio < 0 && errno == EBUSY)
+ return -1;
/* Configure for CD audio */
audio_config(cdda);
/* Fill buffers */
@@ -646,10 +655,11 @@ audio_start(cdda_t *cdda, int start_lba,
(void *)cdda) < 0) {
perror("pthread_create()");
exit(EXIT_FAILURE);
}
+ return 1;
} /* audio_start() */
/*
* cdda_cleanup()
Index: gnome-applets//cdplayer/writer-solaris.h
===================================================================
RCS file: /export/cvs/gnome-2.0/gnome-applets/cdplayer/writer-solaris.h,v
retrieving revision 1.1
diff -p -u -5 -r1.1 writer-solaris.h
--- gnome-applets//cdplayer/writer-solaris.h 2002/07/12 00:27:52 1.1
+++ gnome-applets//cdplayer/writer-solaris.h 2003/03/20 14:45:39
@@ -3,11 +3,11 @@
*/
#ifndef __WRITER_SOLARIS_H__
#define __WRITER_SOLARIS_H__
/* Exported function prototypes */
-void audio_start(cdda_t *, int, int);
+int audio_start(cdda_t *, int, int);
void audio_pause(cdda_t *);
void audio_resume(cdda_t *);
void audio_stop(cdda_t *);
int audio_get_state(cdda_t *, struct cdrom_subchnl *);
void cdda_check(void **, int);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]