Wed, 25 May 2022 23:52:45 -0500
Remove prpl-gtalk from XMPP console
It no longer exists, and complicates the code a bit.
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
24 | |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "pidginconversationwindow.h" |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
27 | #include "gtkconv.h" |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
28 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
29 | enum { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
30 | PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
31 | PIDGIN_CONVERSATION_WINDOW_COLUMN_ICON, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
32 | PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
33 | }; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
34 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
35 | enum { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
36 | SIG_CONVERSATION_SWITCHED, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
37 | N_SIGNALS, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
38 | }; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
39 | static guint signals[N_SIGNALS] = {0, }; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
40 | |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | struct _PidginConversationWindow { |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | GtkApplicationWindow parent; |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | GtkWidget *vbox; |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
45 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
46 | GtkWidget *view; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
47 | GtkTreeStore *model; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
48 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
49 | GtkWidget *stack; |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
50 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
51 | GtkTreePath *conversation_path; |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | }; |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | G_DEFINE_TYPE(PidginConversationWindow, pidgin_conversation_window, |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | GTK_TYPE_APPLICATION_WINDOW) |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
57 | static GtkWidget *default_window = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
58 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
59 | /****************************************************************************** |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
60 | * Callbacks |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
61 | *****************************************************************************/ |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
62 | static void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
63 | pidgin_conversation_window_selection_changed(GtkTreeSelection *selection, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
64 | gpointer data) |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
65 | { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
66 | PidginConversationWindow *window = PIDGIN_CONVERSATION_WINDOW(data); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
67 | GtkTreeModel *model = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
68 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
69 | gboolean changed = FALSE; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
70 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
71 | if(gtk_tree_selection_get_selected(selection, &model, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
72 | gchar *markup = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
73 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
74 | gtk_tree_model_get(model, &iter, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
75 | PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, &markup, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
76 | -1); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
77 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
78 | gtk_stack_set_visible_child_name(GTK_STACK(window->stack), markup); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
79 | g_free(markup); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
80 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
81 | changed = TRUE; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
82 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
83 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
84 | if(!changed) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
85 | gtk_stack_set_visible_child_name(GTK_STACK(window->stack), "__empty__"); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
86 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
87 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
88 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
89 | static gboolean |
|
41186
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
90 | pidgin_conversation_window_key_pressed_cb(GtkEventControllerKey *controller, |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
91 | guint keyval, |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
92 | G_GNUC_UNUSED guint keycode, |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
93 | GdkModifierType state, |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
94 | gpointer data) |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
95 | { |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
96 | PidginConversationWindow *window = data; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
97 | |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
98 | /* If CTRL was held down... */ |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
99 | if (state & GDK_CONTROL_MASK) { |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
100 | switch (keyval) { |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
101 | case GDK_KEY_Page_Down: |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
102 | case GDK_KEY_KP_Page_Down: |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
103 | case ']': |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
104 | pidgin_conversation_window_select_next(window); |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
105 | return TRUE; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
106 | break; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
107 | |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
108 | case GDK_KEY_Page_Up: |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
109 | case GDK_KEY_KP_Page_Up: |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
110 | case '[': |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
111 | pidgin_conversation_window_select_previous(window); |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
112 | return TRUE; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
113 | break; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
114 | } /* End of switch */ |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
115 | } |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
116 | |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
117 | /* If ALT (or whatever) was held down... */ |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
118 | else if (state & GDK_MOD1_MASK) { |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
119 | if ('1' <= keyval && keyval <= '9') { |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
120 | guint switchto = keyval - '1'; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
121 | pidgin_conversation_window_select_nth(window, switchto); |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
122 | |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
123 | return TRUE; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
124 | } |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
125 | } |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
126 | |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
127 | return FALSE; |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
128 | } |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
129 | |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | /****************************************************************************** |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | * GObjectImplementation |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | *****************************************************************************/ |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | static void |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
134 | pidgin_conversation_window_dispose(GObject *obj) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
135 | PidginConversationWindow *window = PIDGIN_CONVERSATION_WINDOW(obj); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
136 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
137 | if(GTK_IS_TREE_MODEL(window->model)) { |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
138 | GtkTreeModel *model = GTK_TREE_MODEL(window->model); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
139 | GtkTreeIter parent, iter; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
140 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
141 | gtk_tree_model_get_iter(model, &parent, window->conversation_path); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
142 | if(gtk_tree_model_iter_children(model, &iter, &parent)) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
143 | gboolean valid = FALSE; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
144 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
145 | /* gtk_tree_store_remove moves the iter to the next item at the |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
146 | * same level, so we abuse that to do our iteration. |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
147 | */ |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
148 | do { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
149 | PurpleConversation *conversation = NULL; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
150 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
151 | gtk_tree_model_get(model, &iter, |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
152 | PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, &conversation, |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
153 | -1); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
154 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
155 | if(PURPLE_IS_CONVERSATION(conversation)) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
156 | pidgin_conversation_detach(conversation); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
157 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
158 | valid = gtk_tree_store_remove(window->model, &iter); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
159 | } |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
160 | } while(valid); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
161 | } |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
162 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
163 | g_clear_pointer(&window->conversation_path, gtk_tree_path_free); |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
164 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
165 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
166 | G_OBJECT_CLASS(pidgin_conversation_window_parent_class)->dispose(obj); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
167 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
168 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
169 | static void |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | pidgin_conversation_window_init(PidginConversationWindow *window) { |
|
41186
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
171 | GtkEventController *key = NULL; |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
172 | GtkTreeIter iter; |
|
40627
3d6797191bf5
Create a new menu bar for PidginConversationWindow. This is just the menu itself and no behavior.
Gary Kramlich <grim@reaperworld.com>
parents:
40577
diff
changeset
|
173 | |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | gtk_widget_init_template(GTK_WIDGET(window)); |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | gtk_window_set_application(GTK_WINDOW(window), |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | GTK_APPLICATION(g_application_get_default())); |
|
40627
3d6797191bf5
Create a new menu bar for PidginConversationWindow. This is just the menu itself and no behavior.
Gary Kramlich <grim@reaperworld.com>
parents:
40577
diff
changeset
|
178 | |
|
41186
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
179 | key = gtk_event_controller_key_new(GTK_WIDGET(window)); |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
180 | gtk_event_controller_set_propagation_phase(key, GTK_PHASE_CAPTURE); |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
181 | g_signal_connect(G_OBJECT(key), "key-pressed", |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
182 | G_CALLBACK(pidgin_conversation_window_key_pressed_cb), |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
183 | window); |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
184 | g_object_set_data_full(G_OBJECT(window), "key-press-controller", key, |
|
f8275d257afe
Move conversation window key handling into its file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41184
diff
changeset
|
185 | g_object_unref); |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
186 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
187 | /* Add our toplevels to the tree store. */ |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
188 | gtk_tree_store_append(window->model, &iter, NULL); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
189 | gtk_tree_store_set(window->model, &iter, |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
190 | PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, _("Conversations"), |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
191 | -1); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
192 | window->conversation_path = gtk_tree_model_get_path(GTK_TREE_MODEL(window->model), |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
193 | &iter); |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | } |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | static void |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | pidgin_conversation_window_class_init(PidginConversationWindowClass *klass) { |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
198 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
201 | obj_class->dispose = pidgin_conversation_window_dispose; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
202 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
203 | signals[SIG_CONVERSATION_SWITCHED] = g_signal_new_class_handler( |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
204 | "conversation-switched", |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
205 | G_OBJECT_CLASS_TYPE(obj_class), |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
206 | G_SIGNAL_RUN_LAST, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
207 | NULL, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
208 | NULL, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
209 | NULL, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
210 | NULL, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
211 | G_TYPE_NONE, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
212 | 1, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
213 | PURPLE_TYPE_CONVERSATION |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
214 | ); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
215 | |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | gtk_widget_class_set_template_from_resource( |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | widget_class, |
|
41030
ec8b76f3bf0a
Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents:
40629
diff
changeset
|
218 | "/im/pidgin/Pidgin3/Conversations/window.ui" |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | ); |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow, |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | vbox); |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
223 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
224 | gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
225 | model); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
226 | gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
227 | view); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
228 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
229 | gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
230 | stack); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
231 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
232 | gtk_widget_class_bind_template_callback(widget_class, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
233 | pidgin_conversation_window_selection_changed); |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | } |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | /****************************************************************************** |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | * API |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | *****************************************************************************/ |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | GtkWidget * |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
240 | pidgin_conversation_window_get_default(void) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
241 | if(!GTK_IS_WIDGET(default_window)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
242 | default_window = pidgin_conversation_window_new(); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
243 | g_object_add_weak_pointer(G_OBJECT(default_window), |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
244 | (gpointer)&default_window); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
245 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
246 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
247 | return default_window; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
248 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
249 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
250 | GtkWidget * |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | pidgin_conversation_window_new(void) { |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CONVERSATION_WINDOW, NULL)); |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | } |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
255 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
256 | pidgin_conversation_window_add(PidginConversationWindow *window, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
257 | PurpleConversation *conversation) |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
258 | { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
259 | PidginConversation *gtkconv = NULL; |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
260 | GtkTreeIter parent, iter; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
261 | GtkTreeModel *model = NULL; |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
262 | const gchar *markup = NULL; |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
263 | gboolean expand = FALSE; |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
264 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
265 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
266 | g_return_if_fail(PURPLE_IS_CONVERSATION(conversation)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
267 | |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
268 | model = GTK_TREE_MODEL(window->model); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
269 | if(!gtk_tree_model_get_iter(model, &parent, window->conversation_path)) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
270 | /* If we can't find the conversation_path we have to bail. */ |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
271 | g_warning("couldn't get an iterator to conversation_path"); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
272 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
273 | return; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
274 | } |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
275 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
276 | if(!gtk_tree_model_iter_has_child(model, &parent)) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
277 | expand = TRUE; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
278 | } |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
279 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
280 | markup = purple_conversation_get_name(conversation); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
281 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
282 | gtkconv = PIDGIN_CONVERSATION(conversation); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
283 | if(gtkconv != NULL) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
284 | GtkWidget *parent = gtk_widget_get_parent(gtkconv->tab_cont); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
285 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
286 | if(GTK_IS_WIDGET(parent)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
287 | g_object_ref(gtkconv->tab_cont); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
288 | gtk_container_remove(GTK_CONTAINER(parent), gtkconv->tab_cont); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
289 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
290 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
291 | gtk_stack_add_named(GTK_STACK(window->stack), gtkconv->tab_cont, markup); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
292 | gtk_widget_show_all(gtkconv->tab_cont); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
293 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
294 | if(GTK_IS_WIDGET(parent)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
295 | g_object_unref(gtkconv->tab_cont); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
296 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
297 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
298 | |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
299 | gtk_tree_store_prepend(window->model, &iter, &parent); |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
300 | gtk_tree_store_set(window->model, &iter, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
301 | PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, conversation, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
302 | PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, markup, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
303 | -1); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
304 | |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
305 | /* If we just added the first child, expand the parent. */ |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
306 | if(expand) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
307 | gtk_tree_view_expand_row(GTK_TREE_VIEW(window->view), |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
308 | window->conversation_path, FALSE); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
309 | } |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
310 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
311 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
312 | if(!gtk_widget_is_visible(GTK_WIDGET(window))) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
313 | gtk_widget_show_all(GTK_WIDGET(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
314 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
315 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
316 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
317 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
318 | pidgin_conversation_window_remove(PidginConversationWindow *window, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
319 | PurpleConversation *conversation) |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
320 | { |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
321 | GtkTreeIter parent, iter; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
322 | GtkTreeModel *model = NULL; |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
323 | GObject *obj = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
324 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
325 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
326 | g_return_if_fail(PURPLE_IS_CONVERSATION(conversation)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
327 | |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
328 | model = GTK_TREE_MODEL(window->model); |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
329 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
330 | if(!gtk_tree_model_get_iter(model, &parent, window->conversation_path)) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
331 | /* The path is somehow invalid, so bail... */ |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
332 | return; |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
333 | } |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
334 | |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
335 | if(!gtk_tree_model_iter_children(model, &iter, &parent)) { |
|
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
336 | /* The conversations iter has no children. */ |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
337 | return; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
338 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
339 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
340 | do { |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
341 | gtk_tree_model_get(model, &iter, |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
342 | PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, &obj, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
343 | -1); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
344 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
345 | if(PURPLE_CONVERSATION(obj) == conversation) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
346 | gtk_tree_store_remove(window->model, &iter); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
347 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
348 | g_clear_object(&obj); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
349 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
350 | break; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
351 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
352 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
353 | g_clear_object(&obj); |
|
41254
ef50e0dc74b0
Add a group for conversation in the PidginConversationWindow tree view
Gary Kramlich <grim@reaperworld.com>
parents:
41252
diff
changeset
|
354 | } while(gtk_tree_model_iter_next(model, &iter)); |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
355 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
356 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
357 | guint |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
358 | pidgin_conversation_window_get_count(PidginConversationWindow *window) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
359 | GList *children = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
360 | guint count = 0; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
361 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
362 | g_return_val_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window), 0); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
363 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
364 | children = gtk_container_get_children(GTK_CONTAINER(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
365 | while(children != NULL) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
366 | children = g_list_delete_link(children, children); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
367 | count++; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
368 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
369 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
370 | return count; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
371 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
372 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
373 | PurpleConversation * |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
374 | pidgin_conversation_window_get_selected(PidginConversationWindow *window) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
375 | PurpleConversation *conversation = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
376 | GtkTreeSelection *selection = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
377 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
378 | |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | g_return_val_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window), NULL); |
|
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
381 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->view)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
382 | if(gtk_tree_selection_get_selected(selection, NULL, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
383 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
384 | gtk_tree_model_get(GTK_TREE_MODEL(window->model), &iter, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
385 | PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, &conversation, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
386 | -1); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
387 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
388 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
389 | return conversation; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
390 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
391 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
392 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
393 | pidgin_conversation_window_select(PidginConversationWindow *window, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
394 | PurpleConversation *conversation) |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
395 | { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
396 | const gchar *name = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
397 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
398 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
399 | g_return_if_fail(PURPLE_IS_CONVERSATION(conversation)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
400 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
401 | name = purple_conversation_get_name(conversation); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
402 | gtk_stack_set_visible_child_name(GTK_STACK(window->stack), name); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
403 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
404 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
405 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
406 | pidgin_conversation_window_select_previous(PidginConversationWindow *window) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
407 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
408 | GtkTreeModel *model = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
409 | GtkTreeSelection *selection = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
410 | gboolean set = FALSE; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
411 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
412 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
413 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
414 | model = GTK_TREE_MODEL(window->model); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
415 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
416 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->view)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
417 | if(gtk_tree_selection_get_selected(selection, NULL, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
418 | if(gtk_tree_model_iter_previous(model, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
419 | gtk_tree_selection_select_iter(selection, &iter); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
420 | set = TRUE; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
421 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
422 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
423 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
424 | if(!set) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
425 | pidgin_conversation_window_select_last(window); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
426 | } |
|
40577
953d563429b8
Create a new PidginConversationWindow widget
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
427 | } |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
428 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
429 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
430 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
431 | pidgin_conversation_window_select_next(PidginConversationWindow *window) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
432 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
433 | GtkTreeModel *model = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
434 | GtkTreeSelection *selection = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
435 | gboolean set = FALSE; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
436 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
437 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
438 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
439 | model = GTK_TREE_MODEL(window->model); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
440 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
441 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->view)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
442 | if(gtk_tree_selection_get_selected(selection, NULL, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
443 | if(gtk_tree_model_iter_next(model, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
444 | gtk_tree_selection_select_iter(selection, &iter); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
445 | set = TRUE; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
446 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
447 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
448 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
449 | if(!set) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
450 | pidgin_conversation_window_select_first(window); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
451 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
452 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
453 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
454 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
455 | pidgin_conversation_window_select_first(PidginConversationWindow *window) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
456 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
457 | GtkTreeModel *model = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
458 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
459 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
460 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
461 | model = GTK_TREE_MODEL(window->model); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
462 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
463 | if(gtk_tree_model_get_iter_first(model, &iter)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
464 | GtkTreeSelection *selection = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
465 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
466 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->view)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
467 | gtk_tree_selection_select_iter(selection, &iter); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
468 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
469 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
470 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
471 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
472 | pidgin_conversation_window_select_last(PidginConversationWindow *window) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
473 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
474 | GtkTreeModel *model = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
475 | gint count = 0; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
476 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
477 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
478 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
479 | model = GTK_TREE_MODEL(window->model); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
480 | count = gtk_tree_model_iter_n_children(model, NULL); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
481 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
482 | if(gtk_tree_model_iter_nth_child(model, &iter, NULL, count - 1)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
483 | GtkTreeSelection *selection = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
484 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
485 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->view)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
486 | gtk_tree_selection_select_iter(selection, &iter); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
487 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
488 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
489 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
490 | void |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
491 | pidgin_conversation_window_select_nth(PidginConversationWindow *window, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
492 | guint nth) |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
493 | { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
494 | GtkTreeIter iter; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
495 | GtkTreeModel *model = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
496 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
497 | g_return_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
498 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
499 | model = GTK_TREE_MODEL(window->model); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
500 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
501 | if(gtk_tree_model_iter_nth_child(model, &iter, NULL, nth)) { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
502 | GtkTreeSelection *selection = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
503 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
504 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->view)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
505 | gtk_tree_selection_select_iter(selection, &iter); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
506 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
507 | } |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
508 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
509 | gboolean |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
510 | pidgin_conversation_window_conversation_is_selected(PidginConversationWindow *window, |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
511 | PurpleConversation *conversation) |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
512 | { |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
513 | const gchar *name = NULL, *visible = NULL; |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
514 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
515 | g_return_val_if_fail(PIDGIN_IS_CONVERSATION_WINDOW(window), FALSE); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
516 | g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), FALSE); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
517 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
518 | name = purple_conversation_get_name(conversation); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
519 | visible = gtk_stack_get_visible_child_name(GTK_STACK(window->stack)); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
520 | |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
521 | return purple_strequal(name, visible); |
|
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
522 | } |