1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-10-02 15:09:07 +00:00
conky/src/moc.h
Phil Sutter d7c7f06aca rework the update machinery to use callbacks
Besides improving performance when updating stuff, we ideally have no
text object specific code in update_stuff() anymore (aside some
leftovers).

The macros in construct_text_object() have gotten a bit crazier than
they were before:
* using CALLBACK(&func) instead of an INFO_* parameter to OBJ() will
  make it add the given callback to the list of callbacks to be iterated
  over at each update interval.
* BEWARE: the above assumes function pointer values to be > 0!
* This implicitly fixes a bug in the code: passing 0 as INFO_* value
  led to selecting INFO_MAIL (1 << 0 == 1).
* Now it would select INFO_CPU (== 0), which got unused and therefore is
  not a problem at all (the 0 value should be unused in enums anyway).

This needs some more work, then we should be able to drop the whole
INFO_* enum. Then CALLBACK() can die again and with it goes the ugly
casting stuff done to distinguish callbacks from INFO_* values.
2009-09-07 00:36:02 +02:00

48 lines
1.1 KiB
C

/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
*
* MOC Conky integration
*
* Please see COPYING for details
*
* Copyright (c) 2008, Henri Häkkinen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MOC_H_
#define MOC_H_
#include "timed_thread.h"
struct moc_s {
char *state;
char *file;
char *title;
char *artist;
char *song;
char *album;
char *totaltime;
char *timeleft;
char *curtime;
char *bitrate;
char *rate;
};
extern struct moc_s moc;
void update_moc(void);
void free_moc(void);
#endif /* MOC_H_ */