Acme 2.0.x and GCalctool (fix0red)

Dagmar d'Surreal dagmar at speakeasy.net
Fri May 16 18:17:40 PDT 2003


Attached is a tiny little patch that alters the behaviour of acme
towards the calculator button on "internet/media" keyboards.  Previously
it would only spawn gnome-calculator, which is sub-optimal for multiple
reasons...
  - GCalctool exists, which has features that would actually be useful
   to programmers, like binary, octal and hex calculations.  
  - Galculator exists, and while less thoroughly tested than GCalctool,
   it's darn nice.

I've already submitted this to Gnome Bugzilla as bug #113159 and the
patch as 
http://bugzilla.gnome.org/showattachment.cgi?attach_id=16584 after
deciding that while I thought it incredibly funny to add a function
named execute_this_that_or_the_other (30 characters!  Still valid!)
and hardwire the application to try gcalctool, galculator and then
gnome-calculator, something more flexible would probably be more
appreciated.  That having been said, the new default is still
gcalctool.  ;)

Anyone wishing to voice their unvarnished opinion about their preference
of Galculator over GCalctool should do so in a _private_ email direct to
me and I'll summarize in a few days.  _Please_ let's not have any more
bloody roll calls on the lists.


PS: -Os and gcc-2.3.2 makes Gnome 2.3.1 psychotic.  Flee.
-------------- next part --------------
! This patch basically changes invocation of the calculator from a hardwired
! behaviour to something we can control at runtime with a gconf key.  The
! new key names should be pretty much obvious, and the new default behaviour
! is to attempt to spawn GCalctool and then gnome-calculator only as a last
! resort.
!   --+ Dagmar d'Surreal
diff -urN acme-2.0.4-pristine/src/acme.c acme-2.0.4/src/acme.c
--- acme-2.0.4-pristine/src/acme.c	2003-05-03 15:27:06.000000000 -0500
+++ acme-2.0.4/src/acme.c	2003-05-16 19:10:36.000000000 -0500
@@ -1120,7 +1120,10 @@
 		do_www_action (acme, "http://www.gnomedesktop.org");
 		break;
 	case CALCULATOR_KEY:
-		execute ("gnome-calculator", FALSE);
+		execute_this_or_that (gconf_client_get_string (acme->conf_client,
+				"/apps/acme/calc_command", NULL),
+				gconf_client_get_string (acme->conf_client,
+				"/apps/acme/calc_alt_command", NULL));
 		break;
 	case RECORD_KEY:
 		execute ("gnome-sound-recorder", FALSE);
diff -urN acme-2.0.4-pristine/src/acme.schemas.in acme-2.0.4/src/acme.schemas.in
--- acme-2.0.4-pristine/src/acme.schemas.in	2002-12-15 09:07:20.000000000 -0600
+++ acme-2.0.4/src/acme.schemas.in	2003-05-16 19:21:21.000000000 -0500
@@ -339,6 +339,30 @@
       </schema>
 
       <schema>
+        <key>/schemas/apps/acme/calc_command</key>
+	<applyto>/apps/acme/calc_command</applyto>
+	<owner>acme</owner>
+	<type>string</type>
+	<default>gcalctool</default>
+	<locale name="C">
+	  <short>Command to execute when the Calculator button is pressed</short>
+	  <long>First choice of calculator program to execute when the Calculator button is pressed</long>
+	</locale>
+      </schema>
+
+      <schema>
+        <key>/schemas/apps/acme/calc_alt_command</key>
+	<applyto>/apps/acme/calc_alt_command</applyto>
+	<owner>acme</owner>
+	<type>string</type>
+	<default>gnome-calculator</default>
+	<locale name="C">
+	  <short>Command to execute when the Calculator button is pressed</short>
+	  <long>Alternate choice of calculator program to execute if the first choice cannot be run</long>
+	</locale>
+      </schema>
+
+      <schema>
         <key>/schemas/apps/acme/soundfile_name</key>
 	<applyto>/apps/acme/soundfile_name</applyto>
 	<owner>acme</owner>


More information about the blfs-dev mailing list