geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

templates.c File Reference
#include "templates.h"
#include "app.h"
#include "document.h"
#include "encodingsprivate.h"
#include "filetypes.h"
#include "geany.h"
#include "geanymenubuttonaction.h"
#include "geanyobject.h"
#include "spawn.h"
#include "support.h"
#include "toolbar.h"
#include "ui_utils.h"
#include "utils.h"
#include <time.h>
#include <string.h>
#include <gtk/gtk.h>
Include dependency graph for templates.c:

Go to the source code of this file.

Functions

static void replace_static_values (GString *text)
 
static gchar * get_template_fileheader (GeanyFiletype *ft)
 
static void templates_replace_default_dates (GString *text)
 
static void templates_replace_command (GString *text, const gchar *file_name, const gchar *file_type, const gchar *func_name)
 
static gchar * read_file (const gchar *locale_fname)
 
static void read_template (const gchar *name, gint id)
 
static void convert_eol_characters (GString *template, GeanyDocument *doc)
 
static void init_general_templates (void)
 
void templates_replace_common (GString *tmpl, const gchar *fname, GeanyFiletype *ft, const gchar *func_name)
 
static gchar * get_template_from_file (const gchar *locale_fname, const gchar *doc_filename, GeanyFiletype *ft)
 
static void on_new_with_file_template (GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
 
static void add_file_item (const gchar *fname, GtkWidget *menu)
 
static void populate_file_template_menu (GtkWidget *menu)
 
static void create_file_template_menu (void)
 
static void on_document_save (G_GNUC_UNUSED GObject *object, GeanyDocument *doc)
 
void templates_init (void)
 
static void make_comment_block (GString *comment_text, gint filetype_idx, guint indent)
 
gchar * templates_get_template_licence (GeanyDocument *doc, gint licence_type)
 
gchar * templates_get_template_fileheader (gint filetype_idx, const gchar *fname)
 
gchar * templates_get_template_function (GeanyDocument *doc, const gchar *func_name)
 
gchar * templates_get_template_changelog (GeanyDocument *doc)
 
static void free_template_menu_items (GtkWidget *menu)
 
void templates_free_templates (void)
 
void templates_replace_valist (GString *text, const gchar *first_wildcard,...)
 
static gchar * run_command (const gchar *command, const gchar *file_name, const gchar *file_type, const gchar *func_name)
 

Variables

GeanyTemplatePrefs template_prefs
 
static GtkWidget * new_with_template_menu = NULL
 
static GtkWidget * new_with_template_toolbar_menu = NULL
 
static gchar * templates [GEANY_MAX_TEMPLATES]
 

Function Documentation

◆ add_file_item()

static void add_file_item ( const gchar *  fname,
GtkWidget *  menu 
)
static

◆ convert_eol_characters()

◆ create_file_template_menu()

◆ free_template_menu_items()

static void free_template_menu_items ( GtkWidget *  menu)
static

Definition at line 506 of file templates.c.

References foreach_list.

Referenced by templates_free_templates().

◆ get_template_fileheader()

static gchar * get_template_fileheader ( GeanyFiletype ft)
static

◆ get_template_from_file()

static gchar * get_template_from_file ( const gchar *  locale_fname,
const gchar *  doc_filename,
GeanyFiletype ft 
)
static

◆ init_general_templates()

static void init_general_templates ( void  )
static

Definition at line 128 of file templates.c.

References read_template().

Referenced by templates_init().

◆ make_comment_block()

static void make_comment_block ( GString *  comment_text,
gint  filetype_idx,
guint  indent 
)
static

◆ on_document_save()

static void on_document_save ( G_GNUC_UNUSED GObject *  object,
GeanyDocument doc 
)
static

◆ on_new_with_file_template()

static void on_new_with_file_template ( GtkMenuItem *  menuitem,
G_GNUC_UNUSED gpointer  user_data 
)
static

◆ populate_file_template_menu()

static void populate_file_template_menu ( GtkWidget *  menu)
static

Definition at line 258 of file templates.c.

References add_file_item(), foreach_slist, GEANY_TEMPLATES_SUBDIR, list, and utils_get_config_files().

Referenced by templates_init().

◆ read_file()

static gchar * read_file ( const gchar *  locale_fname)
static

◆ read_template()

static void read_template ( const gchar *  name,
gint  id 
)
static

◆ replace_static_values()

◆ run_command()

static gchar * run_command ( const gchar *  command,
const gchar *  file_name,
const gchar *  file_type,
const gchar *  func_name 
)
static

Definition at line 592 of file templates.c.

References _, command, error(), NULL, spawn_sync(), and utils_copy_environment().

Referenced by templates_replace_command().

◆ templates_free_templates()

void templates_free_templates ( void  )

◆ templates_get_template_changelog()

◆ templates_get_template_fileheader()

gchar * templates_get_template_fileheader ( gint  filetype_idx,
const gchar *  fname 
)

◆ templates_get_template_function()

◆ templates_get_template_licence()

◆ templates_init()

◆ templates_replace_command()

static void templates_replace_command ( GString *  text,
const gchar *  file_name,
const gchar *  file_type,
const gchar *  func_name 
)
static

◆ templates_replace_common()

◆ templates_replace_default_dates()

◆ templates_replace_valist()

void templates_replace_valist ( GString *  text,
const gchar *  first_wildcard,
  ... 
)

Variable Documentation

◆ new_with_template_menu

GtkWidget* new_with_template_menu = NULL
static

Definition at line 52 of file templates.c.

Referenced by create_file_template_menu(), templates_free_templates(), and templates_init().

◆ new_with_template_toolbar_menu

GtkWidget* new_with_template_toolbar_menu = NULL
static

Definition at line 53 of file templates.c.

Referenced by create_file_template_menu(), templates_free_templates(), and templates_init().

◆ template_prefs

◆ templates