aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2008-03-11 17:27:34 +0800
committerxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2008-03-11 17:27:34 +0800
commit38092421478ccc38d18302b1b4d58c3b52a82341 (patch)
tree61c903ad53d652ca80978ad8ced445f8556b19d9
parent50f4f762ef69611842940d25396816f42e292080 (diff)
downloadgsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.tar
gsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.tar.gz
gsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.tar.bz2
gsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.tar.lz
gsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.tar.xz
gsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.tar.zst
gsoc2013-empathy-38092421478ccc38d18302b1b4d58c3b52a82341.zip
Avoid dup the url string if not needed.
git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@738 4ee84921-47dd-4033-b63a-18d7a039a3e4
-rw-r--r--libempathy-gtk/empathy-ui-utils.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index f5c8d3589..4389da9af 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1303,38 +1303,34 @@ empathy_get_toplevel_window (GtkWidget *widget)
static gchar *
fixup_url (const gchar *url)
{
- gchar *real_url;
-
if (!g_str_has_prefix (url, "http://") &&
!strstr (url, ":/") &&
!strstr (url, "@")) {
- real_url = g_strdup_printf ("http://%s", url);
+ return g_strdup_printf ("http://%s", url);
} else {
- real_url = g_strdup (url);
+ return NULL;
}
-
- return real_url;
}
void
empathy_url_show (const char *url)
{
- gchar *real_url;
- gboolean res;
- GError *err;
+ gchar *real_url;
+ gboolean res;
+ GError *error;
real_url = fixup_url (url);
+ if (real_url) {
+ url = real_url;
+ }
/* FIXME: this does not work for multihead, we should use
* GdkAppLaunchContext for that, when we can depend on GTK+ trunk
*/
- res = g_app_info_launch_default_for_uri (real_url,
- NULL,
- &err);
+ res = g_app_info_launch_default_for_uri (url, NULL, &error);
if (!res) {
empathy_debug (DEBUG_DOMAIN, "Couldn't show URL %s: %s",
- real_url,
- err->message);
- g_error_free (err);
+ url, error->message);
+ g_clear_error (error);
}
g_free (real_url);