I am getting closer to success.

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.
haha
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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值