pidgin/gtkstatus-icon-theme.c

Fri, 05 Mar 2021 03:31:29 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 05 Mar 2021 03:31:29 -0600
changeset 40810
28d50eece92d
parent 39548
dfd989c8236e
permissions
-rw-r--r--

Create a PidginAvatar widget.

This does everything the existing code does, but trying to integrate right now
is kind of difficult. The plan is to use this in a new PidginInfoPane I have
started, but that change got very large so I just packed it into the end of
the existing info pane.

The only things that are not implement right now, are making menu items
insensitive and that's because we need to figure out a better want to handle
custom avatars for users.

Testing Done:
Ran locally.

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

23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
1 /*
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
2 * Status Icon Themes for Pidgin
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
3 *
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
6 * source distribution.
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
7 *
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
12 *
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
17 *
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
21 */
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
22
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
23 #include "gtkstatus-icon-theme.h"
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
24
39548
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
25 /**
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
26 * PidginStatusIconTheme:
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
27 *
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
28 * extends PidginIconTheme (gtkicon-theme.h)
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
29 * A pidgin status icon theme.
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
30 * This object represents a Pidgin status icon theme.
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
31 *
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
32 * PidginStatusIconTheme is a PidginIconTheme Object.
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
33 */
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
34 struct _PidginStatusIconTheme
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
35 {
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
36 PidginIconTheme parent;
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
37 };
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25875
diff changeset
38
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
39 /******************************************************************************
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
40 * Globals
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
41 *****************************************************************************/
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
42
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
43 static GObjectClass *parent_class = NULL;
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23967
diff changeset
44
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
45 /******************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
46 * GObject Stuff
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
47 *****************************************************************************/
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
48
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
49 static void
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23967
diff changeset
50 pidgin_status_icon_theme_finalize(GObject *obj)
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
51 {
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23967
diff changeset
52 parent_class->finalize(obj);
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
53 }
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
54
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
55 static void
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23967
diff changeset
56 pidgin_status_icon_theme_class_init(PidginStatusIconThemeClass *klass)
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
57 {
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
58 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
59
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
60 parent_class = g_type_class_peek_parent(klass);
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
61
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
62 obj_class->finalize = pidgin_status_icon_theme_finalize;
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
63 }
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
64
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
65 GType
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23967
diff changeset
66 pidgin_status_icon_theme_get_type(void)
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
67 {
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
68 static GType type = 0;
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
69 if (type == 0) {
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
70 static const GTypeInfo info = {
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
71 sizeof (PidginStatusIconThemeClass),
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
72 NULL, /* base_init */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
73 NULL, /* base_finalize */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
74 (GClassInitFunc)pidgin_status_icon_theme_class_init, /* class_init */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
75 NULL, /* class_finalize */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
76 NULL, /* class_data */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
77 sizeof (PidginStatusIconTheme),
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
78 0, /* n_preallocs */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
79 NULL,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
80 NULL, /* value table */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
81 };
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
82 type = g_type_register_static(PIDGIN_TYPE_ICON_THEME,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
83 "PidginStatusIconTheme", &info, 0);
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
84 }
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 23973
diff changeset
85 return type;
23967
cc5667bc8f1e Clean up status icon themes a bit
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
86 }

mercurial