aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-08-26 20:31:02 -0500
committerTed Gould <ted@canonical.com>2009-08-26 20:31:02 -0500
commit442d69cb4a309e47bb37b857b28a3ea3b9f75331 (patch)
tree15f5f15a4b5ffc4d880b783372720fd15520f01b
parente97420bc82738e5444053505166b137c8bba0274 (diff)
parentd08632f2c21df15c8edf292910d63f144bb4a7a3 (diff)
downloadayatana-indicator-messages-442d69cb4a309e47bb37b857b28a3ea3b9f75331.tar.gz
ayatana-indicator-messages-442d69cb4a309e47bb37b857b28a3ea3b9f75331.tar.bz2
ayatana-indicator-messages-442d69cb4a309e47bb37b857b28a3ea3b9f75331.zip
Merging in changes that are made possible via an update
to the dbusmenu libraries.
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog7
-rw-r--r--src/app-menu-item.c4
-rw-r--r--src/dbus-data.h4
-rw-r--r--src/im-menu-item.c2
-rw-r--r--src/indicator-messages.c30
-rw-r--r--src/launcher-menu-item.c19
-rw-r--r--src/launcher-menu-item.h1
-rw-r--r--src/messages-service.c2
9 files changed, 62 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 19a549c..d9962a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ GIO_UNIX_REQUIRED_VERSION=2.18
PANEL_REQUIRED_VERSION=2.0.0
INDICATE_REQUIRED_VERSION=0.2.0
INDICATOR_REQUIRED_VERSION=0.2.0
-DBUSMENUGTK_REQUIRED_VERSION=0.0.0
+DBUSMENUGTK_REQUIRED_VERSION=0.0.2
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
diff --git a/debian/changelog b/debian/changelog
index d397184..d37d6d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-messages (0.2.0~bzr126-0ubuntu1~ppa3~menuupdate1) UNRELEASED; urgency=low
+
+ * Merging in changes that are made possible via an update
+ to the dbusmenu libraries.
+
+ -- Ted Gould <ted@ubuntu.com> Wed, 26 Aug 2009 20:30:26 -0500
+
indicator-messages (0.2.0~bzr126-0ubuntu1~ppa2) karmic; urgency=low
* Merging in branch to make it so that the 'green dot' works
diff --git a/src/app-menu-item.c b/src/app-menu-item.c
index 3a2c795..feb780d 100644
--- a/src/app-menu-item.c
+++ b/src/app-menu-item.c
@@ -218,10 +218,10 @@ update_label (AppMenuItem * self)
/* TRANSLATORS: This is the name of the program and the number of indicators. So it
would read something like "Mail Client (5)" */
gchar * label = g_strdup_printf(_("%s (%d)"), app_menu_item_get_name(self), priv->unreadcount);
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", label);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, label);
g_free(label);
} else {
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", app_menu_item_get_name(self));
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, app_menu_item_get_name(self));
}
return;
diff --git a/src/dbus-data.h b/src/dbus-data.h
index e7d4d26..db59003 100644
--- a/src/dbus-data.h
+++ b/src/dbus-data.h
@@ -8,4 +8,8 @@
#define INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT "/org/ayatana/indicator/messages/service"
#define INDICATOR_MESSAGES_DBUS_SERVICE_INTERFACE "org.ayatana.indicator.messages.service"
+#define LAUNCHER_MENUITEM_TYPE "launcher-item"
+#define LAUNCHER_MENUITEM_PROP_APP_NAME "application-name"
+#define LAUNCHER_MENUITEM_PROP_APP_DESC "application-description"
+
#endif /* __DBUS_DATA_H__ */
diff --git a/src/im-menu-item.c b/src/im-menu-item.c
index d35684e..008e33f 100644
--- a/src/im-menu-item.c
+++ b/src/im-menu-item.c
@@ -253,7 +253,7 @@ sender_cb (IndicateListener * listener, IndicateListenerServer * server, Indicat
return;
}
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", propertydata);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, propertydata);
return;
}
diff --git a/src/indicator-messages.c b/src/indicator-messages.c
index 0d2854b..8838313 100644
--- a/src/indicator-messages.c
+++ b/src/indicator-messages.c
@@ -136,6 +136,29 @@ setup_icon_proxy (gpointer userdata)
return FALSE;
}
+static gboolean
+new_launcher_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client)
+{
+ GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new());
+
+ GtkWidget * vbox = gtk_vbox_new(TRUE, 2);
+
+ GtkWidget * app_label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, LAUNCHER_MENUITEM_PROP_APP_NAME));
+ GtkWidget * dsc_label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, LAUNCHER_MENUITEM_PROP_APP_DESC));
+
+ gtk_box_pack_start(GTK_BOX(vbox), app_label, FALSE, FALSE, 0);
+ gtk_widget_show(app_label);
+ gtk_box_pack_start(GTK_BOX(vbox), dsc_label, FALSE, FALSE, 0);
+ gtk_widget_show(dsc_label);
+
+ gtk_container_add(GTK_CONTAINER(gmi), GTK_WIDGET(vbox));
+ gtk_widget_show(GTK_WIDGET(vbox));
+
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
+
+ return TRUE;
+}
+
GtkLabel *
get_label (void)
{
@@ -175,6 +198,11 @@ get_menu (void)
g_idle_add(setup_icon_proxy, NULL);
- return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT));
+ DbusmenuGtkMenu * menu = dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT);
+ DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu);
+
+ dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), LAUNCHER_MENUITEM_TYPE, new_launcher_item);
+
+ return GTK_MENU(menu);
}
diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c
index 802575f..6678cc5 100644
--- a/src/launcher-menu-item.c
+++ b/src/launcher-menu-item.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n.h>
#include <gio/gdesktopappinfo.h>
#include "launcher-menu-item.h"
+#include "dbus-data.h"
enum {
NAME_CHANGED,
@@ -130,7 +131,9 @@ launcher_menu_item_new (const gchar * desktop_file)
priv->desktop = g_strdup(desktop_file);
g_debug("\tName: %s", launcher_menu_item_get_name(self));
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", launcher_menu_item_get_name(self));
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "type", LAUNCHER_MENUITEM_TYPE);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), LAUNCHER_MENUITEM_PROP_APP_NAME, launcher_menu_item_get_name(self));
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), LAUNCHER_MENUITEM_PROP_APP_DESC, launcher_menu_item_get_description(self));
g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL);
@@ -185,20 +188,30 @@ launcher_menu_item_get_desktop (LauncherMenuItem * launchitem)
return priv->desktop;
}
+/* Gets the decription for the item that should
+ go in the messaging menu */
+const gchar *
+launcher_menu_item_get_description (LauncherMenuItem * li)
+{
+ g_return_val_if_fail(IS_LAUNCHER_MENU_ITEM(li), NULL);
+ LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(li);
+ return g_app_info_get_description(priv->appinfo);
+}
+
/* Hides the menu item based on whether it is eclipsed
or not. */
void
launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed)
{
g_debug("Laucher '%s' is %s", launcher_menu_item_get_name(li), eclipsed ? "now eclipsed" : "shown again");
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), "show", eclipsed ? "false" : "true");
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE, eclipsed ? "false" : "true");
return;
}
gboolean
launcher_menu_item_get_eclipsed (LauncherMenuItem * li)
{
- const gchar * show = dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(li), "show");
+ const gchar * show = dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE);
if (show == NULL) {
return FALSE;
}
diff --git a/src/launcher-menu-item.h b/src/launcher-menu-item.h
index 920194e..3e031d5 100644
--- a/src/launcher-menu-item.h
+++ b/src/launcher-menu-item.h
@@ -56,6 +56,7 @@ GType launcher_menu_item_get_type (void);
LauncherMenuItem * launcher_menu_item_new (const gchar * desktop_file);
const gchar * launcher_menu_item_get_name (LauncherMenuItem * appitem);
const gchar * launcher_menu_item_get_desktop (LauncherMenuItem * launchitem);
+const gchar * launcher_menu_item_get_description (LauncherMenuItem * li);
void launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed);
gboolean launcher_menu_item_get_eclipsed (LauncherMenuItem * li);
diff --git a/src/messages-service.c b/src/messages-service.c
index a5af895..093ebfd 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -908,7 +908,7 @@ destroy_launcher (gpointer data)
g_list_free(li->appdiritems);
if (li->menuitem != NULL) {
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li->menuitem), "visible", "false");
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE, "false");
dbusmenu_menuitem_child_delete(root_menuitem, DBUSMENU_MENUITEM(li->menuitem));
g_object_unref(G_OBJECT(li->menuitem));
li->menuitem = NULL;