pidgin/pidginnotifiable.c

Sun, 03 Nov 2024 00:05:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 03 Nov 2024 00:05:44 -0500
changeset 43045
308e8d0ce68c
parent 42757
7c639ab519a1
child 43072
a59a119b74f5
permissions
-rw-r--r--

remove purple3-url-handler.desktop.in.in

The application that did the launching was removed long ago. Also this should
be implemented by the user interfaces and they might provide separate files to
groups schemas as well.

Testing Done:
Called in the turtles.

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

42757
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 */
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "pidginnotifiable.h"
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 /******************************************************************************
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 * GInterface implementation
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 *****************************************************************************/
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 G_DEFINE_INTERFACE(PidginNotifiable, pidgin_notifiable, G_TYPE_INVALID)
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 static void
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 pidgin_notifiable_default_init(PidginNotifiableInterface *iface) {
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 GParamSpec *pspec = NULL;
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 /**
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 * PidginNotifiable:needs-attention:
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 * Whether or not this needs attention.
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 * Since: 3.0
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 */
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 pspec = g_param_spec_boolean(
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 "needs-attention", "needs-attention",
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 "Whether or not this notifiable needs attention.",
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 FALSE,
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 g_object_interface_install_property(iface, pspec);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 /**
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 * PidginNotifiable:notification-count:
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 * The number of notifications.
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 *
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 * Since: 3.0
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 */
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 pspec = g_param_spec_uint(
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 "notification-count", "notifications-count",
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 "The number of notifications.",
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 0, G_MAXUINT, 0,
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 g_object_interface_install_property(iface, pspec);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 }
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 /******************************************************************************
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 * Public API
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 *****************************************************************************/
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 gboolean
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 pidgin_notifiable_get_needs_attention(PidginNotifiable *notifiable) {
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 gboolean ret = FALSE;
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 g_return_val_if_fail(PIDGIN_IS_NOTIFIABLE(notifiable), FALSE);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 g_object_get(G_OBJECT(notifiable), "needs-attention", &ret, NULL);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 return ret;
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 }
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 guint
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 pidgin_notifiable_get_notification_count(PidginNotifiable *notifiable) {
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 guint ret = 0;
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 g_return_val_if_fail(PIDGIN_IS_NOTIFIABLE(notifiable), 0);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 g_object_get(G_OBJECT(notifiable), "notification-count", &ret, NULL);
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 return ret;
7c639ab519a1 Create PidginNotifiable interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 }

mercurial