X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ficonbar.c;h=0cc9ceddc3f446e35f21a5fe4d680cc5b443a2c4;hb=77ad06c3f4bf4d2a4e3a7ff82ec94fcdff343273;hp=b67711ed90c9056ad609d018c395a417872b5279;hpb=2ee78ccecc589385a01ab403b1f64a27e0d2821d;p=citadel.git diff --git a/webcit/iconbar.c b/webcit/iconbar.c index b67711ed9..0cc9ceddc 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -7,109 +7,156 @@ #include "webcit.h" -/* Values for ib_displayas */ -#define IB_PICTEXT 0 -#define IB_PICONLY 1 -#define IB_TEXTONLY 2 +/** Values for ib_displayas */ +#define IB_PICTEXT 0 /**< picture and text */ +#define IB_PICONLY 1 /**< just a picture */ +#define IB_TEXTONLY 2 /**< just text */ -void do_iconbar(void) { - char iconbar[SIZ]; - char buf[SIZ]; - char key[SIZ], value[SIZ]; - int i; - /* The initialized values of these variables also happen to +void do_iconbar(void); +void do_iconbar_roomlist(void); + +/* + * Render the left side iconbar + */ +void do_selected_iconbar(void) { + if (WC->current_iconbar == current_iconbar_roomlist) { + do_iconbar_roomlist(); + } + else { + do_iconbar(); + } +} + +void DontDeleteThis(void *Data){} + +#define IconbarIsEnabled(a, b) IconbarIsENABLED(a, sizeof(a) - 1, b) + +long IconbarIsENABLED(const char *key, size_t keylen, long defval) +{ + void *Data; + if (GetHash(WC->IconBarSetttings, key, keylen, + &Data)) + return (long) Data; + else + return defval; +} + +#ifdef DBG_ICONBAR_HASH +static char nbuf[32]; +inline const char *PrintInt(void *Prefstr) +{ + snprintf(nbuf, sizeof(nbuf), "%ld", (long)Prefstr); + return nbuf; +} +#endif + +void LoadIconSettings(void) +{ + wcsession *WCC = WC; + StrBuf *iconbar = NULL; + StrBuf *buf; + StrBuf *key; + long val; + int i, nTokens; + + buf = NewStrBuf();; + key = NewStrBuf(); + WCC->current_iconbar = current_iconbar_menu; + if (WCC->IconBarSetttings == NULL) + WCC->IconBarSetttings = NewHash(1, NULL); + /** + * The initialized values of these variables also happen to * specify the default values for users who haven't customized * their iconbars. These should probably be set in a master * configuration somewhere. */ - int ib_displayas = 0; /* pictures and text, pictures, text */ - int ib_logo = 0; /* Site logo */ - int ib_summary = 1; /* Summary page icon */ - int ib_inbox = 1; /* Inbox icon */ - int ib_calendar = 1; /* Calendar icon */ - int ib_contacts = 1; /* Contacts icon */ - int ib_notes = 1; /* Notes icon */ - int ib_tasks = 1; /* Tasks icon */ - int ib_rooms = 1; /* Rooms icon */ - int ib_users = 1; /* Users icon */ - int ib_chat = 1; /* Chat icon */ - int ib_advanced = 1; /* Advanced Options icon */ - int ib_citadel = 1; /* 'Powered by Citadel' logo */ - /* - */ - - get_preference("iconbar", iconbar, sizeof iconbar); - for (i=0; i\n" - "