OSDN Git Service

Highlight updated threads
[fukui-no-namari/fukui-no-namari.git] / src / Hage1 / board_window.py
index 46b042b..5c3bd22 100644 (file)
@@ -76,7 +76,22 @@ class WinWrap:
                   "on_popup_menu_open_activate": self.on_open_thread}
         self.mainwin.signal_autoconnect(sigdic)
 
+    def updated_thread_highlight(self, column, cell, model, iter):
+
+        def is_updated_thread():
+            res = model.get_value(
+                iter, ThreadListModel.column_names.index("res"))
+            linecount = model.get_value(
+                iter, ThreadListModel.column_names.index("lineCount"))
+            return res != 0 and linecount != 0 and res > linecount
+
+        if is_updated_thread():
+            cell.set_property("weight", 800)
+        else:
+            cell.set_property("weight", 400)
+
     def on_cell_data(self, column, cell, model, iter, column_name):
+        self.updated_thread_highlight(column, cell, model, iter)
         column_num = ThreadListModel.column_names.index(column_name)
         value = model.get_value(iter, column_num)
         if model.get_column_type(column_num) == gobject.TYPE_INT:
@@ -88,6 +103,7 @@ class WinWrap:
             cell.set_property("text", value)
 
     def on_data_lastmodified(self, column, cell, model, iter, user_data=None):
+        self.updated_thread_highlight(column, cell, model, iter)
         lastmod = model.get_value(
             iter, ThreadListModel.column_names.index("lastModified"))
         if lastmod == 0: