Re: battstat suspend patches



On Mon, 2002-02-18 at 14:46, Kevin Vandersloot wrote:
> Bad Bastien! Use GtkDialog ;) GnomeDialogs are deprecated.

Why o why would one want to depracated something like that. To get
everybody to write their own helper functions ?

Afaics gnome-dialog hasn't been "ported", ie. it doesn't use GtkDialog.
If I port it (or at least the gnome-dialog-utils that I find very
useful), would that be ok to un-deprecate it ?

Cheers

> Kevin
> 
> On 18 Feb 2002 11:01:33 +0000, Bastien Nocera wrote:
> 
> > Content-Type: multipart/mixed; boundary="=-QUmut79w6UPxVOR+OdRa"
> > 
> > 
> > --=-QUmut79w6UPxVOR+OdRa
> > Content-Type: text/plain
> > Content-Transfer-Encoding: quoted-printable
> > 
> > Hi,
> > 
> > Here's a small patch to correct the behaviour of the suspend menu
> > command in battstat (kudos to you kevin for fixing it!), as well as
> > showing the device errors in dialogs rather than in the command-line.
> > 
> > Some strings changes, but i reckon they're needed...
> > 
> > Should I also make gnome-session use g_spawn_* ?
> > 
> > Cheers
> > 
> > --=20
> > /Bastien Nocera
> > http://hadess.net
> > 
> > --=-QUmut79w6UPxVOR+OdRa
> > Content-Disposition: attachment; filename=battstat-suspend-fixes.patch
> > Content-Type: text/plain; charset=ISO-8859-1
> > Content-Transfer-Encoding: quoted-printable
> > 
> > Index: battstat_applet.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file: /cvs/gnome/gnome-applets/battstat/battstat_applet.c,v
> > retrieving revision 1.31
> > diff -u -r1.31 battstat_applet.c
> > --- battstat_applet.c	2002/02/16 22:03:08	1.31
> > +++ battstat_applet.c	2002/02/18 10:55:15
> > @@ -693,7 +693,7 @@
> >    =20
> >     switch (status) {
> >      case 1:
> > -      g_error (
> > +      gnome_error_dialog (
> >  	       /* Displayed if the APM device couldn't be opened. (Used under *BS=
> > D)*/
> >  	       _("Can't open the APM device!\n\n"
> >  		 "Make sure you have read permission to the\n"
> > @@ -701,7 +701,7 @@
> >        exit(1);
> >        break;
> >      case 2:
> > -      g_error (
> > +      gnome_error_dialog (
> >  	       /* Displayed if the APM system is disabled (Used under *BSD)*/	   =
> >  =20
> >  	       _("The APM Management subsystem seems to be disabled.\n"
> >  		 "Try executing \"apm -e 1\" (FreeBSD) and see if \n"
> > @@ -739,7 +739,30 @@
> >     ProgressData *battstat =3D data;
> >    =20
> >     if(battstat->suspend_cmd && strlen(battstat->suspend_cmd)>0) {
> > -      gnome_execute_shell(NULL, battstat->suspend_cmd);
> > +      GError *err =3D NULL;
> > +      gboolean ret;
> > +      gint shell_ret =3D 0;
> > +
> > +      ret =3D g_spawn_command_line_sync(battstat->suspend_cmd,
> > +		      NULL, NULL, &shell_ret, &err);
> > +      if (ret =3D=3D FALSE || shell_ret !=3D 0)
> > +      {
> > +	      gchar *msg;
> > +
> > +	      if (err !=3D NULL)
> > +	      {
> > +		      msg =3D g_strdup_printf(_("An error occured while launching the Su=
> > spend command: %s\nPlease try to correct this error"), err->message);
> > +	      } else {
> > +		      /* Probably because the shell_ret is !=3D 0 */
> > +		      msg =3D g_strdup_printf(_("An error occured while launching the Su=
> > spend command, the command returned \"%d\"\nPlease try to correct this erro=
> > r"), shell_ret);
> > +	      }
> > +	      gnome_error_dialog(msg);
> > +	      g_free(msg);
> > +	      if (err !=3D NULL)
> > +		      g_error_free(err);
> > +      }
> > +   } else {
> > +      gnome_error_dialog(_("Suspend command wasn't setup correctly in the =
> > preferences.\nPlease change the preferences and try again."));
> >     }
> >    =20
> >     return;
> > 
> > --=-QUmut79w6UPxVOR+OdRa--
> > 
> > 
> > 
> > 
> >
> 
> 
> _______________________________________________
> desktop-devel-list mailing list
> desktop-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/desktop-devel-list
> 
> 
-- 
/Bastien Nocera
http://hadess.net

Attachment: pgpgQziJqzv2I.pgp
Description: PGP signature



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