← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/evolution-indicator/command-items into lp:evolution-indicator

 

Ted Gould has proposed merging lp:~ted/evolution-indicator/command-items into lp:evolution-indicator with lp:~ted/evolution-indicator/libindicate-update as a prerequisite.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)


Adds in command items to display in the messaging menu.
-- 
https://code.launchpad.net/~ted/evolution-indicator/command-items/+merge/20624
Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c	2010-03-04 05:13:16 +0000
+++ src/evolution-indicator.c	2010-03-04 05:13:16 +0000
@@ -671,6 +671,19 @@
   update_accounts ();
 }
 
+#define EVO_CONTACTS_CMD  "evolution -c contacts"
+#define EVO_COMPOSE_CMD   "evolution mailto:";
+
+static void
+command_item_activate (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data)
+{
+	gchar * command = (gchar *)user_data;
+	if (!g_spawn_command_line_async(command, NULL)) {
+		g_warning("Unable to execute command '%s'", command);
+	}
+	return;
+}
+
 int
 e_plugin_lib_enable (EPluginLib *ep, int enable)
 {
@@ -710,6 +723,22 @@
     g_signal_connect (server, "server-display",
                       G_CALLBACK (show_evolution), NULL);
 
+	DbusmenuServer * menu_server = dbusmenu_server_new("/messaging/commands");
+	DbusmenuMenuitem * root = dbusmenu_menuitem_new();
+
+	DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
+	dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Compose New Message"));
+	g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(command_item_activate), EVO_COMPOSE_CMD);
+	dbusmenu_menuitem_child_append(root, mi);
+
+	mi = dbusmenu_menuitem_new();
+	dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Contacts"));
+	g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(command_item_activate), EVO_CONTACTS_CMD);
+	dbusmenu_menuitem_child_append(root, mi);
+
+	dbusmenu_server_set_root(menu_server, root);
+	indicate_server_set_menu(server, menu_server);
+
     client = gconf_client_get_default ();
     gconf_client_add_dir (client, CONF_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
 


Follow ups