Example #1
0
static gboolean panel_show_caja_search_uri(GdkScreen* screen, const gchar* uri, guint32 timestamp, GError** error)
{
	char* desktopfile = NULL;
	GDesktopAppInfo* appinfo = NULL;
	gboolean ret;

	desktopfile = panel_g_lookup_in_applications_dirs("caja-folder-handler.desktop");

	if (desktopfile)
	{
		appinfo = g_desktop_app_info_new_from_filename(desktopfile);
		g_free(desktopfile);
	}

	if (!appinfo)
	{
		_panel_show_error_dialog (uri, screen, _("No application to handle search folders is installed."));
		return FALSE;
	}

	ret = panel_app_info_launch_uri(appinfo, uri, screen, timestamp, error);
	g_object_unref(appinfo);

	return ret;
}
Example #2
0
gboolean
panel_show_uri_force_mime_type (GdkScreen    *screen,
				const gchar  *uri,
				const gchar  *mime_type,
				guint32       timestamp,
				GError      **error)
{
	GFile    *file;
	GAppInfo *app;
	gboolean  ret;

	g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
	g_return_val_if_fail (uri != NULL, FALSE);
	g_return_val_if_fail (mime_type != NULL, FALSE);
	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

	file = g_file_new_for_uri (uri);
	app = g_app_info_get_default_for_type (mime_type,
					       !g_file_is_native (file));
	g_object_unref (file);

	if (app == NULL) {
		/* no application for the mime type, so let's fallback on
		 * automatic detection */
		return panel_show_uri (screen, uri, timestamp, error);
	}

	ret = panel_app_info_launch_uri (app, uri, screen, timestamp, error);
	g_object_unref (app);

	return ret;
}