Thu, 04 Oct 2018 17:01:18 -0500
Port Pidgin away from deprecated g_type_class_add_private()
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
2 | * Icon Themes for Pidgin |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
3 | * |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
6 | * source distribution. |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
7 | * |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
12 | * |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
17 | * |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
22 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
23 | #include "gtkicon-theme.h" |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
24 | #include "pidginstock.h" |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
25 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
26 | #include <gtk/gtk.h> |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
27 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
28 | /****************************************************************************** |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
29 | * Structs |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
30 | *****************************************************************************/ |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
31 | |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
32 | typedef struct { |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
33 | /* used to store filenames of diffrent icons */ |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
34 | GHashTable *icon_files; |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
35 | } PidginIconThemePrivate; |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
36 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
37 | /****************************************************************************** |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
38 | * Globals |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
39 | *****************************************************************************/ |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
40 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
41 | G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PidginIconTheme, pidgin_icon_theme, |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
42 | PURPLE_TYPE_THEME); |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
43 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
44 | /****************************************************************************** |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
45 | * GObject Stuff |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
46 | *****************************************************************************/ |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
47 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
48 | static void |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
49 | pidgin_icon_theme_init(PidginIconTheme *theme) |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
50 | { |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
51 | PidginIconThemePrivate *priv; |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
52 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
53 | priv = pidgin_icon_theme_get_instance_private(theme); |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
54 | |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
55 | priv->icon_files = g_hash_table_new_full(g_str_hash, |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
56 | g_str_equal, g_free, g_free); |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
57 | } |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
58 | |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
59 | static void |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
60 | pidgin_icon_theme_finalize(GObject *obj) |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
61 | { |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
62 | PidginIconThemePrivate *priv; |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
63 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
64 | priv = pidgin_icon_theme_get_instance_private(PIDGIN_ICON_THEME(obj)); |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
65 | |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
66 | g_hash_table_destroy(priv->icon_files); |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
67 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
68 | G_OBJECT_CLASS(pidgin_icon_theme_parent_class)->finalize(obj); |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
69 | } |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
70 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
71 | static void |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
72 | pidgin_icon_theme_class_init(PidginIconThemeClass *klass) |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
73 | { |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
74 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
75 | |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
76 | obj_class->finalize = pidgin_icon_theme_finalize; |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
77 | } |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
78 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
79 | /***************************************************************************** |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
80 | * Public API functions |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
81 | *****************************************************************************/ |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
82 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
83 | const gchar * |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
84 | pidgin_icon_theme_get_icon(PidginIconTheme *theme, |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
85 | const gchar *id) |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
86 | { |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
87 | PidginIconThemePrivate *priv; |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
88 | |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
89 | g_return_val_if_fail(PIDGIN_IS_ICON_THEME(theme), NULL); |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
90 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
91 | priv = pidgin_icon_theme_get_instance_private(theme); |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
92 | |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
93 | return g_hash_table_lookup(priv->icon_files, id); |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
94 | } |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
95 | |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
96 | void |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
97 | pidgin_icon_theme_set_icon(PidginIconTheme *theme, |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
98 | const gchar *id, |
|
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
99 | const gchar *filename) |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
100 | { |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
101 | PidginIconThemePrivate *priv; |
|
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
102 | g_return_if_fail(PIDGIN_IS_ICON_THEME(theme)); |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
103 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
32438
diff
changeset
|
104 | priv = pidgin_icon_theme_get_instance_private(theme); |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
105 | |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
106 | if (filename != NULL) |
|
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23967
diff
changeset
|
107 | g_hash_table_replace(priv->icon_files, |
|
25875
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
108 | g_strdup(id), g_strdup(filename)); |
|
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
109 | else |
|
a98b16817658
Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents:
23973
diff
changeset
|
110 | g_hash_table_remove(priv->icon_files, id); |
|
23965
13cd30de531b
Add the icon theme files, and re-work some things
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
111 | } |