Commit 9a747239 authored by Christian Hergert's avatar Christian Hergert
Browse files

source-view: make file check more succinct

parent 47e05221
......@@ -3640,32 +3640,21 @@ ide_source_view_real_push_snippet (IdeSourceView *self,
const GtkTextIter *location)
{
IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
IdeFile *file;
GFile *gfile;
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (IDE_IS_SOURCE_SNIPPET (snippet));
g_assert (IDE_IS_SOURCE_SNIPPET_CONTEXT (context));
if (priv->buffer != NULL)
if ((priv->buffer != NULL) &&
(file = ide_buffer_get_file (priv->buffer)) &&
(gfile = ide_file_get_file (file)))
{
IdeFile *file;
file = ide_buffer_get_file (priv->buffer);
if (file != NULL)
{
GFile *gfile;
g_autofree gchar *name = NULL;
gfile = ide_file_get_file (file);
if (gfile != NULL)
{
gchar *name = NULL;
name = g_file_get_basename (gfile);
ide_source_snippet_context_add_variable (context, "filename", name);
g_free (name);
}
}
name = g_file_get_basename (gfile);
ide_source_snippet_context_add_variable (context, "filename", name);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment