[Evolution-hackers] Adding menu items
- From: Justin Wake <jwake iinet net au>
- To: evolution-hackers lists ximian com
- Subject: [Evolution-hackers] Adding menu items
- Date: Sat, 28 Aug 2004 02:33:34 +0800
I've spent most of the evening hacking away at
http://bugzilla.gnome.org/show_bug.cgi?id=127552 and I'm at a bit of a
loss as to how to (correctly) add the menu item for the sync program.
I've attached a short patch to add it underneath the 'Pilot Settings'
item on the Tools menu, but I can't seem to find the best way of doing
it *properly* (ie, only appearing in the menu if it finds evolution-
ipod-sync in the path). Maybe I'm just looking in the wrong files -
anybody want to point me in the right direction?
Thanks,
Justin Wake
Index: shell/e-shell-window-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window-commands.c,v
retrieving revision 1.21
diff -u -r1.21 e-shell-window-commands.c
--- shell/e-shell-window-commands.c 1 Aug 2004 17:58:08 -0000 1.21
+++ shell/e-shell-window-commands.c 27 Aug 2004 16:55:04 -0000
@@ -75,6 +75,30 @@
e_notice (NULL, GTK_MESSAGE_ERROR, _("Error executing %s."), args[0]);
}
+static void
+launch_ipod_sync (void)
+{
+ char *args[] = {
+ "evolution-ipod-sync",
+ NULL
+ };
+
+ int pid;
+
+ args[0] = g_find_program_in_path ("evolution-ipod-sync");
+ if (!args[0]) {
+ e_notice (NULL, GTK_MESSAGE_ERROR,
+ _("The Evolution to iPod synchronize tool does not appear to be installed on this system."));
+ return;
+ }
+
+ pid = gnome_execute_async (NULL, 1, args);
+
+ if (pid == -1)
+ e_notice (NULL, GTK_MESSAGE_ERROR, _("Error executing %s."), args[0]);
+
+ g_free (args[0]);
+}
/* Command callbacks. */
@@ -485,6 +509,13 @@
launch_pilot_settings (NULL);
}
+static void
+command_ipod_sync (BonoboUIComponent *uih,
+ EShellWindow *window,
+ const char *path)
+{
+ launch_ipod_sync ();
+}
static BonoboUIVerb file_verbs [] = {
BONOBO_UI_VERB ("FileImporter", (BonoboUIVerbFn) command_import),
@@ -513,7 +544,8 @@
static BonoboUIVerb tools_verbs[] = {
BONOBO_UI_VERB ("Settings", (BonoboUIVerbFn) command_settings),
BONOBO_UI_VERB ("PilotSettings", (BonoboUIVerbFn) command_pilot_settings),
-
+ BONOBO_UI_VERB ("IPodSync", (BonoboUIVerbFn) command_ipod_sync),
+
BONOBO_UI_VERB_END
};
Index: ui/evolution.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution.xml,v
retrieving revision 1.94
diff -u -r1.94 evolution.xml
--- ui/evolution.xml 2 Jun 2004 20:37:45 -0000 1.94
+++ ui/evolution.xml 27 Aug 2004 16:55:10 -0000
@@ -88,6 +88,7 @@
<separator/>
<placeholder name="ComponentPlaceholder"/>
<menuitem name="PilotSettings" verb="" _label="Pi_lot Settings..." _tip="Set up Pilot configuration"/>
+ <menuitem name="IPodSync" verb="" _label="Synchronize to _iPod..." _tip="Synchronize data to an iPod"/>
</submenu>
<placeholder name="SearchPlaceholder">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]