blob: f1d70ad3ef733b6b7bf2343d067b0f56a3ae02bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
* This file is part of gedit
*
* Copyright (C) 2020 Sébastien Wilmet <swilmet@gnome.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "gedit-factory.h"
#include <glib/gi18n.h>
#include "gedit-dirs.h"
G_DEFINE_TYPE (GeditFactory, gedit_factory, TEPL_TYPE_ABSTRACT_FACTORY)
static gchar *
untitled_file_cb (gint untitled_file_number)
{
return g_strdup_printf (_("Untitled Document %d"), untitled_file_number);
}
static TeplFile *
gedit_factory_create_file (TeplAbstractFactory *factory)
{
TeplFile *file;
file = tepl_file_new ();
tepl_file_set_untitled_file_callback (file, untitled_file_cb);
return file;
}
static GFile *
gedit_factory_create_metadata_manager_file (TeplAbstractFactory *factory)
{
return g_file_new_build_filename (gedit_dirs_get_user_data_dir (),
"gedit-metadata.xml",
NULL);
}
static void
gedit_factory_class_init (GeditFactoryClass *klass)
{
TeplAbstractFactoryClass *factory_class = TEPL_ABSTRACT_FACTORY_CLASS (klass);
factory_class->create_file = gedit_factory_create_file;
factory_class->create_metadata_manager_file = gedit_factory_create_metadata_manager_file;
}
static void
gedit_factory_init (GeditFactory *factory)
{
}
GeditFactory *
gedit_factory_new (void)
{
return g_object_new (GEDIT_TYPE_FACTORY, NULL);
}
|