[epiphany] ephy-file-helpers: make .desktop file launcher method parameters optional



commit 52b5de7fb81e96af073d159869c508996a1ddb55
Author: Xan Lopez <xlopez igalia com>
Date:   Mon Aug 29 15:48:03 2011 +0200

    ephy-file-helpers: make .desktop file launcher method parameters optional
    
    We don't always need them.

 lib/ephy-file-helpers.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index ebf163d..f1003b6 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -738,7 +738,7 @@ ephy_file_launch_application (GAppInfo *app,
 /**
  * ephy_file_launch_desktop_file:
  * @filename: the path to the .desktop file
- * @parameter: path to a parameter file to pass to the application
+ * @parameter: path to an optional parameter file to pass to the application
  * @user_time: user time to prevent focus stealing
  * @widget: an optional widget for ephy_file_launch_application()
  *
@@ -754,17 +754,21 @@ ephy_file_launch_desktop_file (const char *filename,
 			       GtkWidget *widget)
 {
 	GDesktopAppInfo *app;
-	GFile *file;
+	GFile *file = NULL;
 	GList *list = NULL;
 	gboolean ret;
 
 	app = g_desktop_app_info_new (filename);
-	file = g_file_new_for_path (parameter);
-	list = g_list_append (list, file);
+	if (parameter)
+	{
+		file = g_file_new_for_path (parameter);
+		list = g_list_append (list, file);
+	}
 	
 	ret = ephy_file_launch_application (G_APP_INFO (app), list, user_time, widget);
 	g_list_free (list);
-	g_object_unref (file);
+	if (file)
+		g_object_unref (file);
 	return ret;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]