libpurple/theme-loader.c

Tue, 06 Apr 2021 03:35:20 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 06 Apr 2021 03:35:20 -0500
changeset 40840
b5f355f90ab0
parent 40195
fb4b0ae193c0
permissions
-rw-r--r--

Port the updates from 2.14.2 and the upcoming 2.14.3 to 3.0.0

* Use the unicode version of the System and UserInfo plugins to fix
non-english languages in the Windows installer.
* Update the installer to use the inetc plugin so that https downloads will
work. This became necessary because Sourceforge now redirects http to
https.
* Standardize everything in pidgin/win32/winpidgin.c to use `wprintf`.

Testing Done:
Compiled and ran on windows 10.

Reviewed at https://reviews.imfreedom.org/r/595/

23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
1 /*
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
2 * ThemeLoaders for libpurple
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
3 *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
6 * source distribution.
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
7 *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
12 *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
17 *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
21 */
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
22
25005
e86ff053dd10 Fix some theme manager assertion failures.
Richard Laager <rlaager@pidgin.im>
parents: 23971
diff changeset
23 #include "internal.h"
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
24 #include "theme-loader.h"
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
25
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
26 void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type);
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
27
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
28 /******************************************************************************
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
29 * Structs
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
30 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
31 typedef struct {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
32 gchar *type;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
33 } PurpleThemeLoaderPrivate;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
34
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
35 /******************************************************************************
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
36 * Enums
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
37 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
38
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
39 enum {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
40 PROP_ZERO = 0,
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
41 PROP_TYPE,
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
42 PROP_LAST
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
43 };
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
44
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
45 /******************************************************************************
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
46 * Globals
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
47 *****************************************************************************/
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
48
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
49 static GParamSpec *properties[PROP_LAST];
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
50
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
51 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PurpleThemeLoader, purple_theme_loader,
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
52 G_TYPE_OBJECT);
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
53
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
54 /******************************************************************************
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
55 * GObject Stuff *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
56 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
57
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
58 static void
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
59 purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value,
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
60 GParamSpec *psec)
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
61 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
62 PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
63
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
64 switch (param_id) {
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
65 case PROP_TYPE:
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
66 g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader));
33770
6625cbf09e08 Fix various other minor issues identified in the coverity scan.
Daniel Atallah <datallah@pidgin.im>
parents: 28763
diff changeset
67 break;
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
68 default:
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
69 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
70 break;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
71 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
72 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
73
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
74 static void
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
75 purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value,
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
76 GParamSpec *psec)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
77 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
78 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
79
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
80 switch (param_id) {
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
81 case PROP_TYPE:
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
82 purple_theme_loader_set_type_string(loader, g_value_get_string(value));
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
83 break;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
84 default:
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
85 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
86 break;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
87 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
88 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
89
32955
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
90 static gboolean
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
91 purple_theme_loader_probe_directory(PurpleThemeLoader *loader, const gchar *dir)
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
92 {
32955
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
93 const gchar *type = purple_theme_loader_get_type_string(loader);
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
94 char *themedir;
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
95 gboolean result;
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
96
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
97 /* Checks for directory as $root/purple/$type */
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
98 themedir = g_build_filename(dir, "purple", type, NULL);
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
99 result = g_file_test(themedir, G_FILE_TEST_IS_DIR);
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
100 g_free(themedir);
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
101
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
102 return result;
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
103 }
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
104
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
105 static void
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
106 purple_theme_loader_init(PurpleThemeLoader *loader)
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
107 {
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
108 }
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
109
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
110 static void
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
111 purple_theme_loader_finalize(GObject *obj)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
112 {
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
113 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
114 PurpleThemeLoaderPrivate *priv =
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
115 purple_theme_loader_get_instance_private(loader);
23645
6901039a86fb Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23644
diff changeset
116
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
117 g_free(priv->type);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
118
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
119 G_OBJECT_CLASS(purple_theme_loader_parent_class)->finalize(obj);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
120 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
121
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
122 static void
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
123 purple_theme_loader_class_init(PurpleThemeLoaderClass *klass)
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
124 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
125 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
126
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
127 obj_class->get_property = purple_theme_loader_get_property;
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
128 obj_class->set_property = purple_theme_loader_set_property;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
129 obj_class->finalize = purple_theme_loader_finalize;
23645
6901039a86fb Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23644
diff changeset
130
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
131 /* TYPE STRING (read only) */
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
132 properties[PROP_TYPE] = g_param_spec_string("type", "Type",
28448
c5ca106a9c74 Fix some typos.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
133 "The string representing the type of the theme",
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
134 NULL,
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 33774
diff changeset
135 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 33774
diff changeset
136 G_PARAM_STATIC_STRINGS);
35085
abab0adfa0ec libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35078
diff changeset
137
abab0adfa0ec libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35078
diff changeset
138 g_object_class_install_properties(obj_class, PROP_LAST, properties);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
139 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
140
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
141 /*****************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
142 * Public API functions
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
143 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
144
23653
79934bf9a349 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
145 const gchar *
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25005
diff changeset
146 purple_theme_loader_get_type_string(PurpleThemeLoader *theme_loader)
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
147 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
148 PurpleThemeLoaderPrivate *priv = NULL;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
149
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
150 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
151
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
152 priv = purple_theme_loader_get_instance_private(theme_loader);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
153 return priv->type;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
154 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
155
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
156 /* < private > */
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
157 void
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
158 purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
159 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
160 PurpleThemeLoaderPrivate *priv;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
161
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
162 g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
163
39364
54439db24429 libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 35085
diff changeset
164 priv = purple_theme_loader_get_instance_private(loader);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
165
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
166 g_free(priv->type);
23653
79934bf9a349 Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23647
diff changeset
167 priv->type = g_strdup(type);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 33774
diff changeset
168
35078
9e2aff0b8476 libpurple: started changing g_object_notify to g_object_notify_by_pspec
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
169 g_object_notify_by_pspec(G_OBJECT(loader), properties[PROP_TYPE]);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
170 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
171
23971
9764690b14f2 Changed PurpleTheme build function to only return PurpleTheme*
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23970
diff changeset
172 PurpleTheme *
23970
85dcf9218f63 fixes initialize icon theme bug by pre-loading the theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
173 purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir)
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
174 {
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
175 return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
176 }
32955
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
177
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
178 gboolean
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
179 purple_theme_loader_probe(PurpleThemeLoader *loader, const gchar *dir)
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
180 {
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
181 if (PURPLE_THEME_LOADER_GET_CLASS(loader)->probe_directory != NULL)
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
182 return PURPLE_THEME_LOADER_GET_CLASS(loader)->probe_directory(dir);
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
183 else
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
184 return purple_theme_loader_probe_directory(loader, dir);
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
185 }
e984f8b98a19 Add a directory probe to theme loaders. The default just checks for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
186

mercurial