diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/app-menu-item.c | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 55e1bda..a10d74f 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,12 @@ AC_CONFIG_MACRO_DIR([m4]) ########################### GTK_REQUIRED_VERSION=2.12 +GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 INDICATE_REQUIRED_VERSION=0.1 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION + gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION) AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 01fd25b..bf6fe8a 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -26,6 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib/gi18n.h> #include <gtk/gtk.h> +#include <gio/gdesktopappinfo.h> #include "app-menu-item.h" typedef struct _AppMenuItemPrivate AppMenuItemPrivate; @@ -36,7 +37,7 @@ struct _AppMenuItemPrivate IndicateListenerServer * server; gchar * type; - gchar * desktop; + GAppInfo * appinfo; GtkWidget * name; }; @@ -77,7 +78,7 @@ app_menu_item_init (AppMenuItem *self) priv->server = NULL; priv->name = NULL; priv->type = NULL; - priv->desktop = NULL; + priv->appinfo = NULL; return; @@ -140,11 +141,14 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar AppMenuItem * self = APP_MENU_ITEM(data); AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self); - if (priv->desktop != NULL) { - g_free(priv->desktop); + if (priv->appinfo != NULL) { + g_object_unref(G_OBJECT(priv->appinfo)); } - priv->desktop = g_strdup(value); + priv->appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(value)); + g_return_if_fail(priv->appinfo != NULL); + + gtk_label_set_text(GTK_LABEL(priv->name), g_app_info_get_name(priv->appinfo)); return; } |