Sun, 19 Nov 2023 00:37:50 -0600
Use the AccountManager's signals to control the sensitivity of the menus
Testing Done:
Toggled demo, ircv3, and xmpp accounts and verified all of the menus were updated appropriately.
Reviewed at https://reviews.imfreedom.org/r/2835/
|
42050
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "pidgindisplayitem.h" |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | struct _PidginDisplayItem { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | GObject parent; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | GtkWidget *widget; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | char *id; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | char *title; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | char *icon_name; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | gboolean needs_attention; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | guint badge_number; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | GListModel *children; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | }; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | enum { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | PROP_0, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PROP_WIDGET, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PROP_ID, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PROP_TITLE, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_ICON_NAME, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_NEEDS_ATTENTION, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PROP_BADGE_NUMBER, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | PROP_CHILDREN, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | N_PROPERTIES, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | }; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | static GParamSpec *properties[N_PROPERTIES] = {NULL,}; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | G_DEFINE_TYPE(PidginDisplayItem, pidgin_display_item, G_TYPE_OBJECT) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | /****************************************************************************** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | * Helpers |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | *****************************************************************************/ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | pidgin_display_item_set_widget(PidginDisplayItem *item, GtkWidget *widget) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | if(g_set_object(&item->widget, widget)) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | g_object_notify_by_pspec(G_OBJECT(item), properties[PROP_WIDGET]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | pidgin_display_item_set_id(PidginDisplayItem *item, const char *id) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | g_return_if_fail(id != NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | if(item->id == id) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | return; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | g_free(item->id); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | item->id = g_strdup(id); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | g_object_notify_by_pspec(G_OBJECT(item), properties[PROP_ID]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | /****************************************************************************** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | * GObject Implementation |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | *****************************************************************************/ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | pidgin_display_item_dispose(GObject *obj) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | PidginDisplayItem *item = PIDGIN_DISPLAY_ITEM(obj); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | g_clear_object(&item->widget); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | g_clear_object(&item->children); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | G_OBJECT_CLASS(pidgin_display_item_parent_class)->dispose(obj); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | pidgin_display_item_finalize(GObject *obj) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | PidginDisplayItem *item = PIDGIN_DISPLAY_ITEM(obj); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | g_clear_pointer(&item->id, g_free); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | g_clear_pointer(&item->title, g_free); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | g_clear_pointer(&item->icon_name, g_free); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | G_OBJECT_CLASS(pidgin_display_item_parent_class)->finalize(obj); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | pidgin_display_item_get_property(GObject *obj, guint param_id, GValue *value, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | GParamSpec *pspec) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | PidginDisplayItem *item = PIDGIN_DISPLAY_ITEM(obj); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | switch(param_id) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | case PROP_WIDGET: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | g_value_set_object(value, pidgin_display_item_get_widget(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | case PROP_ID: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | g_value_set_string(value, pidgin_display_item_get_id(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | case PROP_TITLE: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | g_value_set_string(value, pidgin_display_item_get_title(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | case PROP_ICON_NAME: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | g_value_set_string(value, pidgin_display_item_get_icon_name(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | case PROP_NEEDS_ATTENTION: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | g_value_set_boolean(value, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | pidgin_display_item_get_needs_attention(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | case PROP_BADGE_NUMBER: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | g_value_set_uint(value, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | pidgin_display_item_get_badge_number(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | case PROP_CHILDREN: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | g_value_set_object(value, pidgin_display_item_get_children(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | default: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | pidgin_display_item_set_property(GObject *obj, guint param_id, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | const GValue *value, GParamSpec *pspec) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | PidginDisplayItem *item = PIDGIN_DISPLAY_ITEM(obj); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | switch(param_id) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | case PROP_WIDGET: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | pidgin_display_item_set_widget(item, g_value_get_object(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | case PROP_ID: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | pidgin_display_item_set_id(item, g_value_get_string(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | case PROP_TITLE: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | pidgin_display_item_set_title(item, g_value_get_string(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | case PROP_ICON_NAME: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | pidgin_display_item_set_icon_name(item, g_value_get_string(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | case PROP_NEEDS_ATTENTION: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | pidgin_display_item_set_needs_attention(item, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | g_value_get_boolean(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | case PROP_BADGE_NUMBER: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | pidgin_display_item_set_badge_number(item, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | g_value_get_uint(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | case PROP_CHILDREN: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | pidgin_display_item_set_children(item, g_value_get_object(value)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | default: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | break; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | pidgin_display_item_init(G_GNUC_UNUSED PidginDisplayItem *window) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | static void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | pidgin_display_item_class_init(PidginDisplayItemClass *klass) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | obj_class->dispose = pidgin_display_item_dispose; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | obj_class->finalize = pidgin_display_item_finalize; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | obj_class->get_property = pidgin_display_item_get_property; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | obj_class->set_property = pidgin_display_item_set_property; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | * PidginDisplayItem:widget: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | * The [class@Gtk.Widget] that this item is for. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | properties[PROP_WIDGET] = g_param_spec_object( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | "widget", "widget", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | "The widget for this item", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | GTK_TYPE_WIDGET, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | * PidginDisplayItem:id: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | * A unique identifier for this item. This is used for things like |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | * remembering positions and selections. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | properties[PROP_ID] = g_param_spec_string( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | "id", "id", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | "A unique identifier for the item", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | NULL, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | * PidginDisplayItem:title: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | * The title that should be displayed for this item. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | properties[PROP_TITLE] = g_param_spec_string( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | "title", "title", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | "The title for the item", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | NULL, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | * PidginDisplayItem:icon-name: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | * The icon name to use for this item. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | properties[PROP_ICON_NAME] = g_param_spec_string( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | "icon-name", "icon-name", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | "The icon-name to use for this item", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | NULL, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | * PidginDisplayItem:needs-attention: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | * Determines whether the item should show that it needs attention or not. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | properties[PROP_NEEDS_ATTENTION] = g_param_spec_boolean( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | "needs-attention", "needs-attention", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | "Whether or not the item needs attention", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | FALSE, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | * PidginDisplayItem:badge-number: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | * The number that should be shown in the badge. Typically this is an |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | * unread count. If this is 0 it should not be displayed. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | properties[PROP_BADGE_NUMBER] = g_param_spec_uint( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | "badge-number", "badge-number", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | "The number to show in the badge", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | 0, G_MAXUINT, 0, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | /** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | * PidginDisplayItem:children: |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | * A [iface@Gio.ListModel] of child items. The type of the model needs to |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | * be [class@Pidgin.DisplayItem]. |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | * Since: 3.0.0 |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | */ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | properties[PROP_CHILDREN] = g_param_spec_object( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | "children", "children", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | "A GListModel of child items", |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | G_TYPE_LIST_MODEL, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | /****************************************************************************** |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | * API |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | *****************************************************************************/ |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | PidginDisplayItem * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | pidgin_display_item_new(GtkWidget *widget, const char *id) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | g_return_val_if_fail(id != NULL, NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | return g_object_new( |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | PIDGIN_TYPE_DISPLAY_ITEM, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | "widget", widget, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | "id", id, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | GtkWidget * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | pidgin_display_item_get_widget(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | return item->widget; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | const char * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | pidgin_display_item_get_id(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | return item->id; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | const char * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | pidgin_display_item_get_title(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | return item->title; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | pidgin_display_item_set_title(PidginDisplayItem *item, const char *title) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | if(item->title == title) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | return; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | g_free(item->title); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | item->title = g_strdup(title); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | g_object_notify_by_pspec(G_OBJECT(item), properties[PROP_TITLE]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | const char * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | pidgin_display_item_get_icon_name(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | return item->icon_name; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | pidgin_display_item_set_icon_name(PidginDisplayItem *item, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | const char *icon_name) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | if(item->icon_name == icon_name) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | return; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | g_free(item->icon_name); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | item->icon_name = g_strdup(icon_name); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | g_object_notify_by_pspec(G_OBJECT(item), properties[PROP_ICON_NAME]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | gboolean |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | pidgin_display_item_get_needs_attention(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), FALSE); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
366 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
367 | return item->needs_attention; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | pidgin_display_item_set_needs_attention(PidginDisplayItem *item, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | gboolean needs_attention) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | if(item->needs_attention != needs_attention) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
377 | item->needs_attention = needs_attention; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | g_object_notify_by_pspec(G_OBJECT(item), |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | properties[PROP_NEEDS_ATTENTION]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | guint |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | pidgin_display_item_get_badge_number(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), 0); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | return item->badge_number; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | pidgin_display_item_set_badge_number(PidginDisplayItem *item, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | guint badge_number) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | if(item->badge_number != badge_number) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | item->badge_number = badge_number; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | g_object_notify_by_pspec(G_OBJECT(item), |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | properties[PROP_BADGE_NUMBER]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | GListModel * |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | pidgin_display_item_get_children(PidginDisplayItem *item) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | g_return_val_if_fail(PIDGIN_IS_DISPLAY_ITEM(item), NULL); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | return item->children; |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
410 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
411 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | void |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | pidgin_display_item_set_children(PidginDisplayItem *item, |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | GListModel *children) |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
416 | g_return_if_fail(PIDGIN_IS_DISPLAY_ITEM(item)); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
417 | |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
418 | if(g_set_object(&item->children, children)) { |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
419 | g_object_notify_by_pspec(G_OBJECT(item), properties[PROP_CHILDREN]); |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
420 | } |
|
5ac6db2b8c2d
Make the DisplayWindow use a GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
421 | } |