summaryrefslogtreecommitdiff
path: root/packages/pimlico/tasks-0.10/delete-crash.diff
blob: 0b2ba473d436655b674089fe677a064f312f76cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Index: libkoto/koto-utils.c
===================================================================
--- libkoto/koto-utils.c	(revision 294)
+++ libkoto/koto-utils.c	(revision 295)
@@ -25,6 +25,7 @@
 
 typedef struct {
   GtkWindow *window;
+  GtkTreeModel *model;
   char *title;
 } WindowData;
 
@@ -67,19 +68,21 @@
 /*
  * Update the window title, generally as the number of tasks has changed.
  */
-static void
-update_title (WindowData *data, GtkTreeModel *model)
+static gboolean
+update_title (gpointer user_data)
 {
+  WindowData *data = user_data;
   int count = 0;
   char *title;
 
   g_assert (data);
-  g_assert (model);
 
-  gtk_tree_model_foreach (model, count_pending, &count);
+  gtk_tree_model_foreach (data->model, count_pending, &count);
   title = g_strdup_printf (data->title, count);
   gtk_window_set_title (data->window, title);
   g_free (title);
+
+  return FALSE;
 }
 
 /*
@@ -89,7 +92,7 @@
 static void
 on_row_inserted (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, WindowData *data)
 {
-  update_title (data, model);
+  g_idle_add (update_title, data);
 }
 
 /*
@@ -99,7 +102,7 @@
 static void
 on_row_deleted (GtkTreeModel *model, GtkTreePath *path, WindowData *data)
 {
-  update_title (data, model);
+  g_idle_add (update_title, data);
 }
 
 /*
@@ -135,6 +138,7 @@
   
   data = g_slice_new (WindowData);
   data->window = window;
+  data->model = model;
   data->title = g_strdup (title);
   
   g_object_weak_ref (G_OBJECT (model), on_weak_notify, data);
@@ -145,5 +149,5 @@
                     "signal::row-deleted", G_CALLBACK (on_row_deleted), data,
                     NULL);
 
-  update_title (data, model);
+  update_title (data);
 }