In the past two weeks, I found that when I switched the category, I found that the log messages were automatically organized and displayed perfectly in the model.
I was very happy about this, so I was wondering why I didn’t use this implementation method to achieve my thoughts. So I went to the bottom of this function to call some functions and then added to APPEND of gl-journal.c (the place where the new message can be detected).
static gboolean
on_journal_changed (gint fd,
GIOCondition condition,
GlJournal *self)
{
gint ret;
GlJournalEntry *entry;
GlJournalPrivate *priv = gl_journal_get_instance_private (self);
ret = sd_journal_process (priv->journal);
switch (ret)
{
case SD_JOURNAL_NOP:
g_debug ("Journal change was a no-op");
break;
case SD_JOURNAL_APPEND: //add in the case
g_debug ("New journal entries added");
After several experiments, yes, it is cool, it is realized at once. The function of automatic refresh.
I am very happy to send my results to my tutor, but he said that he can’t call it directly in that place.
It doesn’t matter, anyway,I am getting closer to success.
In fact, this is true, I use global variables, which is a bad habit in programming, and it will be that the structure of the code becomes confusing, but the effect is that effect.
This week has been a waste of time, is always looking for shortcuts to achieve this function. It turns out that it doesn’t work. In fact, in life, you should not do this. You must be down to earth, one step at a time.
JUNE 14, 2018