-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdark-theme.c
65 lines (52 loc) · 1.82 KB
/
dark-theme.c
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
/*
* Copyright 2017 Colomban Wendling <colomban@geany.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <geanyplugin.h>
#if !GTK_CHECK_VERSION (3, 0, 0)
# error "This plugin only supports GTK+ 3.0 and newer"
#endif
static gboolean orig_setting = FALSE;
static GtkSettings *settings = NULL;
static gboolean
dt_init (GeanyPlugin *plugin,
gpointer data G_GNUC_UNUSED)
{
settings = gtk_widget_get_settings (plugin->geany_data->main_widgets->window);
g_object_get (settings, "gtk-application-prefer-dark-theme", &orig_setting, NULL);
g_object_set (settings, "gtk-application-prefer-dark-theme", TRUE, NULL);
return TRUE;
}
static void
dt_cleanup (GeanyPlugin *plugin G_GNUC_UNUSED,
gpointer data G_GNUC_UNUSED)
{
g_object_set (settings, "gtk-application-prefer-dark-theme", orig_setting, NULL);
}
G_MODULE_EXPORT
void
geany_load_module (GeanyPlugin *plugin)
{
main_locale_init (LOCALEDIR, GETTEXT_PACKAGE);
plugin->info->name = _("Dark UI Theme");
plugin->info->description = _("Selects a dark UI theme");
plugin->info->version = "0";
plugin->info->author = "Colomban Wendling <colomban@geany.org>";
plugin->funcs->init = dt_init;
plugin->funcs->cleanup = dt_cleanup;
GEANY_PLUGIN_REGISTER (plugin, 225);
}