pidgin/pidginconversationwindow.c

changeset 41441
e114ed471a1e
parent 41254
ef50e0dc74b0
child 41443
60cec3b7ad30
equal deleted inserted replaced
41440:348cc74f084e 41441:e114ed471a1e
26 26
27 #include "gtkconv.h" 27 #include "gtkconv.h"
28 28
29 enum { 29 enum {
30 PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, 30 PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT,
31 PIDGIN_CONVERSATION_WINDOW_COLUMN_NAME,
31 PIDGIN_CONVERSATION_WINDOW_COLUMN_ICON, 32 PIDGIN_CONVERSATION_WINDOW_COLUMN_ICON,
32 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, 33 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP,
33 }; 34 };
34 35
35 enum { 36 enum {
45 46
46 GtkWidget *view; 47 GtkWidget *view;
47 GtkTreeStore *model; 48 GtkTreeStore *model;
48 49
49 GtkWidget *stack; 50 GtkWidget *stack;
51
52 GtkWidget *notification_list;
50 53
51 GtkTreePath *conversation_path; 54 GtkTreePath *conversation_path;
52 }; 55 };
53 56
54 G_DEFINE_TYPE(PidginConversationWindow, pidgin_conversation_window, 57 G_DEFINE_TYPE(PidginConversationWindow, pidgin_conversation_window,
67 GtkTreeModel *model = NULL; 70 GtkTreeModel *model = NULL;
68 GtkTreeIter iter; 71 GtkTreeIter iter;
69 gboolean changed = FALSE; 72 gboolean changed = FALSE;
70 73
71 if(gtk_tree_selection_get_selected(selection, &model, &iter)) { 74 if(gtk_tree_selection_get_selected(selection, &model, &iter)) {
72 gchar *markup = NULL; 75 gchar *name = NULL;
73 76
74 gtk_tree_model_get(model, &iter, 77 gtk_tree_model_get(model, &iter,
75 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, &markup, 78 PIDGIN_CONVERSATION_WINDOW_COLUMN_NAME, &name,
76 -1); 79 -1);
77 80
78 gtk_stack_set_visible_child_name(GTK_STACK(window->stack), markup); 81 gtk_stack_set_visible_child_name(GTK_STACK(window->stack), name);
79 g_free(markup); 82 g_free(name);
80 83
81 changed = TRUE; 84 changed = TRUE;
82 } 85 }
83 86
84 if(!changed) { 87 if(!changed) {
183 window); 186 window);
184 g_object_set_data_full(G_OBJECT(window), "key-press-controller", key, 187 g_object_set_data_full(G_OBJECT(window), "key-press-controller", key,
185 g_object_unref); 188 g_object_unref);
186 189
187 /* Add our toplevels to the tree store. */ 190 /* Add our toplevels to the tree store. */
191 gtk_tree_store_append(window->model, &iter, NULL);
192 gtk_tree_store_set(window->model, &iter,
193 PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, window->notification_list,
194 PIDGIN_CONVERSATION_WINDOW_COLUMN_NAME, "__notifications__",
195 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, _("Notifications"),
196 -1);
197
188 gtk_tree_store_append(window->model, &iter, NULL); 198 gtk_tree_store_append(window->model, &iter, NULL);
189 gtk_tree_store_set(window->model, &iter, 199 gtk_tree_store_set(window->model, &iter,
190 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, _("Conversations"), 200 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, _("Conversations"),
191 -1); 201 -1);
192 window->conversation_path = gtk_tree_model_get_path(GTK_TREE_MODEL(window->model), 202 window->conversation_path = gtk_tree_model_get_path(GTK_TREE_MODEL(window->model),
226 gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow, 236 gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow,
227 view); 237 view);
228 238
229 gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow, 239 gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow,
230 stack); 240 stack);
241 gtk_widget_class_bind_template_child(widget_class, PidginConversationWindow,
242 notification_list);
231 243
232 gtk_widget_class_bind_template_callback(widget_class, 244 gtk_widget_class_bind_template_callback(widget_class,
233 pidgin_conversation_window_selection_changed); 245 pidgin_conversation_window_selection_changed);
234 } 246 }
235 247
297 } 309 }
298 310
299 gtk_tree_store_prepend(window->model, &iter, &parent); 311 gtk_tree_store_prepend(window->model, &iter, &parent);
300 gtk_tree_store_set(window->model, &iter, 312 gtk_tree_store_set(window->model, &iter,
301 PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, conversation, 313 PIDGIN_CONVERSATION_WINDOW_COLUMN_OBJECT, conversation,
314 PIDGIN_CONVERSATION_WINDOW_COLUMN_NAME, markup,
302 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, markup, 315 PIDGIN_CONVERSATION_WINDOW_COLUMN_MARKUP, markup,
303 -1); 316 -1);
304 317
305 /* If we just added the first child, expand the parent. */ 318 /* If we just added the first child, expand the parent. */
306 if(expand) { 319 if(expand) {

mercurial