[Top][All Lists]

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

Re: An example for Adding a menu item

From: John Darrington
Subject: Re: An example for Adding a menu item
Date: Mon, 16 May 2011 16:30:54 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Mon, May 16, 2011 at 10:17:02AM +0300, eran liberty wrote:
     Hi Ben and All,
     My friend is a lecturer for statistics and, with my encouraging, is
     willing to try to create a new course based only on open source tools
     ( OpenOffice ). As intended PSPP is a prime key for this experiment to

It's always good to hear that people are interested in pspp, especially in
teaching environments.
     As it is PSPP is missing some key ingredients which the SPSS have and
     are essential to my friends course. ( like General Linear Modeling
     which spss has)

GLM is awaiting a type 3 sums of squares calculation.  I believe Jason is
working on this, but I don't know how far he's got.  Once this is done, then
a basic GLM (univariate, no interactions) will be complete.

     I decided to get my hand dirty and fill in the gaps. I have strong
     background of Linux kernel / Networking / Autotools and whats not... I
     have very weak background of GUI and UI design patterns.
     I tried to hack your PSPP to add another menu item under "Analyze" and 
     Could you point me to a checkin which illustrate nicely the addition
     of a menu item along with all the skeleton construct (callbacks,
     triggers, sub menus, actions?)...
Commit 21f2e65c7c2555bf5422920651eab07d1e8f5154 is one such change.

To add the menuitem it makes the following change to src/ui/gui/data-editor.ui
+          <object class="GtkAction" id="data_aggregate">
+           <property name="stock-id">pspp-aggregate</property>
+            <property name="name">data_aggregate</property>
+            <property name="label" translatable="yes">_Aggregate</property>
+          </object>
+        </child>

Note, that in order for this to be visible, you'll have to re-run make install,
so that the new .ui file gets installed.

Then, iit adds the  line:

+  connect_action (de, "data_aggregate", G_CALLBACK (aggregate_dialog));

to src/ui/gui/psppire-data-window.c which tells it to associate the function
aggregate_dialog with the new menuitem.

This function can do whatever you like, but typically it creates a widget of 
type PsppireDialog and populates it with the various controls.

I hope this helps.


PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]