feat: add news ticker with sentiment analysis and error codes to dwn.h and news.h headers
- Add DwnStatus enum with six error codes (OK, ERROR, INVALID_ARG, NO_MEMORY, NOT_FOUND, DISPLAY, IO) to include/dwn.h - Extend NewsArticle struct with NewsSentiment enum (NEUTRAL, POSITIVE, NEGATIVE) and sentiment_score float field in include/news.h - Insert DWN_ASSERT and DWN_ASSERT_MSG contract assertion macros plus assert.h include into include/util.h
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* AI Integration (OpenRouter API)
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Application launcher with .desktop file support
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* X11 Atoms management (EWMH/ICCCM compliance)
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Client (window) management
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Configuration system
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Window decorations (title bars, borders, buttons)
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Main header with shared types and global state
|
||||
*/
|
||||
|
||||
@@ -32,6 +33,17 @@
|
||||
#define DEFAULT_PANEL_HEIGHT 28
|
||||
#define DEFAULT_GAP 4
|
||||
|
||||
/* Common error/status codes */
|
||||
typedef enum {
|
||||
DWN_OK = 0,
|
||||
DWN_ERROR = -1,
|
||||
DWN_ERROR_INVALID_ARG = -2,
|
||||
DWN_ERROR_NO_MEMORY = -3,
|
||||
DWN_ERROR_NOT_FOUND = -4,
|
||||
DWN_ERROR_DISPLAY = -5,
|
||||
DWN_ERROR_IO = -6
|
||||
} DwnStatus;
|
||||
|
||||
/* Layout types */
|
||||
typedef enum {
|
||||
LAYOUT_TILING,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Keyboard shortcut handling
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Layout algorithms (tiling, floating, monocle)
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* News ticker for bottom panel
|
||||
*/
|
||||
|
||||
@@ -13,12 +14,21 @@
|
||||
#define MAX_NEWS_ARTICLES 50
|
||||
#define NEWS_API_URL "https://news.app.molodetz.nl/api"
|
||||
|
||||
/* Sentiment classification */
|
||||
typedef enum {
|
||||
SENTIMENT_NEUTRAL = 0,
|
||||
SENTIMENT_POSITIVE,
|
||||
SENTIMENT_NEGATIVE
|
||||
} NewsSentiment;
|
||||
|
||||
/* News article */
|
||||
typedef struct {
|
||||
char title[256];
|
||||
char content[1024];
|
||||
char link[512];
|
||||
char author[128];
|
||||
NewsSentiment sentiment;
|
||||
float sentiment_score;
|
||||
} NewsArticle;
|
||||
|
||||
/* News ticker state */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* D-Bus Notification daemon
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Panel system (top and bottom panels with widgets)
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* System tray widgets (WiFi, Audio, etc.)
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Utility functions
|
||||
*/
|
||||
|
||||
@@ -9,6 +10,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* Contract assertion macro - use for programmer errors */
|
||||
#define DWN_ASSERT(cond) assert(cond)
|
||||
#define DWN_ASSERT_MSG(cond, msg) assert((cond) && (msg))
|
||||
|
||||
/* Logging levels */
|
||||
typedef enum {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* DWN - Desktop Window Manager
|
||||
* retoor <retoor@molodetz.nl>
|
||||
* Workspace (tag/virtual desktop) management
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user