From 52875e80b988a7f0c5af3d4ebe720917f93c873d Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 23 Aug 2012 10:37:04 +0200 Subject: libmessaging-menu: warn when desktop_id is NULL (instead of crashing) --- libmessaging-menu/messaging-menu.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index 336e89c..b8aaf20 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -74,6 +74,21 @@ static void global_status_changed (IndicatorMessagesService *service, const gchar *status_str, gpointer user_data); +static void +messaging_menu_app_set_desktop_id (MessagingMenuApp *app, + const gchar *desktop_id) +{ + g_return_if_fail (desktop_id != NULL); + + /* no need to clean up, it's construct only */ + app->appinfo = g_desktop_app_info_new (desktop_id); + if (app->appinfo == NULL) + { + g_warning ("could not find the desktop file for '%s'", + desktop_id); + } +} + static void messaging_menu_app_set_property (GObject *object, guint prop_id, @@ -85,12 +100,7 @@ messaging_menu_app_set_property (GObject *object, switch (prop_id) { case PROP_DESKTOP_ID: - app->appinfo = g_desktop_app_info_new (g_value_get_string (value)); - if (app->appinfo == NULL) - { - g_warning ("could not find the desktop file for '%s'", - g_value_get_string (value)); - } + messaging_menu_app_set_desktop_id (app, g_value_get_string (value)); break; default: -- cgit v1.2.3