Sun, 03 Nov 2024 00:05:44 -0500
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/
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <purple.h> |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
27 | #include "pidginnotificationlist.h" |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
29 | #include "pidginnotifiable.h" |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
30 | #include "pidginnotification.h" |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
31 | #include "pidginnotificationaddcontact.h" |
|
42961
9b94dce254d8
Create Pidgin.NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents:
42951
diff
changeset
|
32 | #include "pidginnotificationauthorizationrequest.h" |
|
42986
f535fef9f727
Create Pidgin.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
42963
diff
changeset
|
33 | #include "pidginnotificationconnectionerror.h" |
|
42951
37816f063275
Create Pidgin.NotificationLink for displaying Purple.NotificationLink's
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
34 | #include "pidginnotificationlink.h" |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
36 | enum { |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
37 | PROP_0, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
38 | N_PROPERTIES, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
39 | /* Overrides */ |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
40 | PROP_NEEDS_ATTENTION = N_PROPERTIES, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
41 | PROP_NOTIFICATION_COUNT, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
42 | }; |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
43 | /* There's no global properties because we only have overrides right now. */ |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
44 | |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | struct _PidginNotificationList { |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | GtkBox parent; |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
42629
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
48 | GtkStack *stack; |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
49 | GtkSingleSelection *selection_model; |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | }; |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | /****************************************************************************** |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | * Helpers |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | *****************************************************************************/ |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
55 | static guint |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
56 | pidgin_notification_list_get_count(PidginNotificationList *list) { |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
57 | g_return_val_if_fail(PIDGIN_IS_NOTIFICATION_LIST(list), 0); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
58 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
59 | return g_list_model_get_n_items(G_LIST_MODEL(list->selection_model)); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
60 | } |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
61 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
62 | static gboolean |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
63 | pidgin_notification_list_get_needs_attention(PidginNotificationList *list) { |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
64 | guint count = 0; |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
65 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
66 | g_return_val_if_fail(PIDGIN_IS_NOTIFICATION_LIST(list), FALSE); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
67 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
68 | count = g_list_model_get_n_items(G_LIST_MODEL(list->selection_model)); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
69 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
70 | return (count > 0); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
71 | } |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
72 | |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
73 | /****************************************************************************** |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
74 | * Callbacks |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
75 | *****************************************************************************/ |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
76 | static void |
|
42629
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
77 | pidgin_notification_list_items_changed_cb(GListModel *model, |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
78 | G_GNUC_UNUSED guint position, |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
79 | G_GNUC_UNUSED guint added, |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
80 | G_GNUC_UNUSED guint removed, |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
81 | gpointer data) |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
82 | { |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
83 | PidginNotificationList *list = data; |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
84 | GObject *obj = G_OBJECT(list); |
|
42629
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
85 | |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
86 | if(g_list_model_get_n_items(model) != 0) { |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
87 | gtk_stack_set_visible_child_name(list->stack, "view"); |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
88 | } else { |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
89 | gtk_stack_set_visible_child_name(list->stack, "placeholder"); |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
90 | } |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
91 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
92 | g_object_freeze_notify(obj); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
93 | g_object_notify(obj, "needs-attention"); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
94 | g_object_notify(obj, "notification-count"); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
95 | g_object_thaw_notify(obj); |
|
42629
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
96 | } |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
97 | |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
98 | static void |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
99 | pidgin_notification_list_bind_cb(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
100 | GObject *object, |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
101 | G_GNUC_UNUSED gpointer data) |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41936
diff
changeset
|
102 | { |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
103 | PurpleNotification *notification = NULL; |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
104 | GtkListItem *item = GTK_LIST_ITEM(object); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | GtkWidget *widget = NULL; |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
107 | notification = gtk_list_item_get_item(item); |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
108 | |
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
109 | if(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification)) { |
|
42963
049b6a96fd2a
Tweak a few things with Pidgin.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
42961
diff
changeset
|
110 | PurpleNotificationAddContact *notification_add_contact = NULL; |
|
049b6a96fd2a
Tweak a few things with Pidgin.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
42961
diff
changeset
|
111 | |
|
049b6a96fd2a
Tweak a few things with Pidgin.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
42961
diff
changeset
|
112 | notification_add_contact = PURPLE_NOTIFICATION_ADD_CONTACT(notification); |
|
049b6a96fd2a
Tweak a few things with Pidgin.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
42961
diff
changeset
|
113 | widget = pidgin_notification_add_contact_new(notification_add_contact); |
|
42961
9b94dce254d8
Create Pidgin.NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents:
42951
diff
changeset
|
114 | } else if(PURPLE_IS_NOTIFICATION_AUTHORIZATION_REQUEST(notification)) { |
|
9b94dce254d8
Create Pidgin.NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents:
42951
diff
changeset
|
115 | PurpleNotificationAuthorizationRequest *request = NULL; |
|
9b94dce254d8
Create Pidgin.NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents:
42951
diff
changeset
|
116 | |
|
9b94dce254d8
Create Pidgin.NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents:
42951
diff
changeset
|
117 | request = PURPLE_NOTIFICATION_AUTHORIZATION_REQUEST(notification); |
|
9b94dce254d8
Create Pidgin.NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents:
42951
diff
changeset
|
118 | widget = pidgin_notification_authorization_request_new(request); |
|
42986
f535fef9f727
Create Pidgin.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
42963
diff
changeset
|
119 | } else if(PURPLE_IS_NOTIFICATION_CONNECTION_ERROR(notification)) { |
|
f535fef9f727
Create Pidgin.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
42963
diff
changeset
|
120 | PurpleNotificationConnectionError *error = NULL; |
|
f535fef9f727
Create Pidgin.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
42963
diff
changeset
|
121 | |
|
f535fef9f727
Create Pidgin.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
42963
diff
changeset
|
122 | error = PURPLE_NOTIFICATION_CONNECTION_ERROR(notification); |
|
f535fef9f727
Create Pidgin.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
42963
diff
changeset
|
123 | widget = pidgin_notification_connection_error_new(error); |
|
42951
37816f063275
Create Pidgin.NotificationLink for displaying Purple.NotificationLink's
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
124 | } else if(PURPLE_IS_NOTIFICATION_LINK(notification)) { |
|
37816f063275
Create Pidgin.NotificationLink for displaying Purple.NotificationLink's
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
125 | widget = pidgin_notification_link_new(notification); |
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
126 | } else { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
42917
diff
changeset
|
127 | widget = pidgin_notification_new(notification); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | } |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
130 | gtk_list_item_set_child(item, widget); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | } |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | /****************************************************************************** |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
134 | * PidginNotifiable Implementation |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
135 | *****************************************************************************/ |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
136 | static void |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
137 | pidgin_notification_list_notifiable_init(G_GNUC_UNUSED PidginNotifiableInterface *iface) { |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
138 | } |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
139 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
140 | /****************************************************************************** |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | * GObject Implementation |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | *****************************************************************************/ |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
143 | G_DEFINE_FINAL_TYPE_WITH_CODE( |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
144 | PidginNotificationList, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
145 | pidgin_notification_list, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
146 | GTK_TYPE_BOX, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
147 | G_IMPLEMENT_INTERFACE(PIDGIN_TYPE_NOTIFIABLE, pidgin_notification_list_notifiable_init)) |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
148 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
149 | static void |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
150 | pidgin_notification_list_get_property(GObject *obj, guint param_id, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
151 | GValue *value, GParamSpec *pspec) |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
152 | { |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
153 | PidginNotificationList *list = PIDGIN_NOTIFICATION_LIST(obj); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
154 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
155 | switch(param_id) { |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
156 | case PROP_NEEDS_ATTENTION: |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
157 | g_value_set_boolean(value, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
158 | pidgin_notification_list_get_needs_attention(list)); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
159 | break; |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
160 | case PROP_NOTIFICATION_COUNT: |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
161 | g_value_set_uint(value, pidgin_notification_list_get_count(list)); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
162 | break; |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
163 | default: |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
164 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
165 | break; |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
166 | } |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
167 | } |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
168 | |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | static void |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | pidgin_notification_list_init(PidginNotificationList *list) { |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
171 | GListModel *model = NULL; |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
172 | |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | gtk_widget_init_template(GTK_WIDGET(list)); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
175 | model = purple_notification_manager_get_default_as_model(); |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
176 | gtk_single_selection_set_model(list->selection_model, model); |
|
42629
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
177 | g_signal_connect(model, "items-changed", |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
178 | G_CALLBACK(pidgin_notification_list_items_changed_cb), |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
179 | list); |
|
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
180 | pidgin_notification_list_items_changed_cb(model, 0, 0, 0, list); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | } |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | static void |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | pidgin_notification_list_class_init(PidginNotificationListClass *klass) { |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
185 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | |
|
42758
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
188 | obj_class->get_property = pidgin_notification_list_get_property; |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
189 | |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
190 | g_object_class_override_property(obj_class, PROP_NEEDS_ATTENTION, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
191 | "needs-attention"); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
192 | g_object_class_override_property(obj_class, PROP_NOTIFICATION_COUNT, |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
193 | "notification-count"); |
|
f95b932717bb
Implement PidginNotifiable on PidginNotificationList
Gary Kramlich <grim@reaperworld.com>
parents:
42629
diff
changeset
|
194 | |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | gtk_widget_class_set_template_from_resource( |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | widget_class, |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
197 | "/im/pidgin/Pidgin3/notificationlist.ui" |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | ); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | gtk_widget_class_bind_template_child(widget_class, PidginNotificationList, |
|
42629
03341514e25a
Restore placeholder page for notification list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42627
diff
changeset
|
201 | stack); |
|
42627
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
202 | gtk_widget_class_bind_template_child(widget_class, PidginNotificationList, |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
203 | selection_model); |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
204 | |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
205 | gtk_widget_class_bind_template_callback(widget_class, |
|
8378ac3ef0f1
Convert PidginNotificationList to GtkListView
Gary Kramlich <grim@reaperworld.com>
parents:
42575
diff
changeset
|
206 | pidgin_notification_list_bind_cb); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | } |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | /****************************************************************************** |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | * API |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | *****************************************************************************/ |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | GtkWidget * |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | pidgin_notification_list_new(void) { |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | return g_object_new(PIDGIN_TYPE_NOTIFICATION_LIST, NULL); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | } |