void csstidy::merge_4value_shorthands(string media, string selector) { for(map< string, vector<string> >::iterator i = shorthands.begin(); i != shorthands.end(); ++i ) { string temp; if(css[media][selector].has(i->second[0]) && css[media][selector].has(i->second[1]) && css[media][selector].has(i->second[2]) && css[media][selector].has(i->second[3])) { string important = ""; for(int j = 0; j < 4; ++j) { string val = css[media][selector][i->second[j]]; if(is_important(val)) { important = "!important"; temp += gvw_important(val)+ " "; } else { temp += val + " "; } css[media][selector].erase(i->second[j]); } add(media, selector, i->first, shorthand(trim(temp + important))); } } }
void get_pending_events(gboolean* unread, gboolean* important) { const char *im=purple_prefs_get_string("/plugins/gtk/ftdi-hwnotify/im"); const char *chat=purple_prefs_get_string("/plugins/gtk/ftdi-hwnotify/chat"); GList *l_im = NULL; GList *l_chat = NULL; *unread = FALSE; *important = FALSE; if (im != NULL && strcmp(im, "always") == 0) { l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM, PIDGIN_UNSEEN_TEXT, FALSE, 1); } else if (im != NULL && strcmp(im, "hidden") == 0) { l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM, PIDGIN_UNSEEN_TEXT, TRUE, 1); } // check for chat if (chat != NULL && strcmp(chat, "always") == 0) { l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT, PIDGIN_UNSEEN_TEXT, FALSE, 1); } else if (chat != NULL && strcmp(chat, "nick") == 0) { l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT, PIDGIN_UNSEEN_NICK, FALSE, 1); } gboolean unimportant = FALSE; // check for important contacts if (l_im != NULL && color_important != LED_NONE) { GList* p = l_im; while (p != NULL) { PurpleConversation* conv = (PurpleConversation*)p->data; if (is_important (conv->account->username)) *important = TRUE; else unimportant = TRUE; p = p->next; } } if (!*important) unimportant = TRUE; if (l_im != NULL || l_chat != NULL) *unread = unimportant; if (l_im != NULL) g_list_free (l_im); if (l_chat != NULL) g_list_free (l_chat); }
void csstidy::add(const string& media, const string& selector, const string& property, const string& value) { if(settings["preserve_css"]) { return; } if(css[media][selector].has(property)) { if( !is_important(css[media][selector][property]) || (is_important(css[media][selector][property]) && is_important(value)) ) { css[media][selector].erase(property); css[media][selector][property] = trim(value); } } else { css[media][selector][property] = trim(value); } }
map<string,string> csstidy::dissolve_4value_shorthands(string property, string value) { map<string, string> ret; extern map< string, vector<string> > shorthands; if(shorthands[property][0] == "0") { ret[property] = value; return ret; } string important = ""; if(is_important(value)) { value = gvw_important(value); important = "!important"; } vector<string> values = explode(" ",value); if(values.size() == 4) { for(int i=0; i < 4; ++i) { ret[shorthands[property][i]] = values[i] + important; } } else if(values.size() == 3) { ret[shorthands[property][0]] = values[0] + important; ret[shorthands[property][1]] = values[1] + important; ret[shorthands[property][3]] = values[1] + important; ret[shorthands[property][2]] = values[2] + important; } else if(values.size() == 2) { for(int i = 0; i < 4; ++i) { ret[shorthands[property][i]] = ((i % 2 != 0)) ? values[1] + important : values[0] + important; } } else { for(int i = 0; i < 4; ++i) { ret[shorthands[property][i]] = values[0] + important; } } return ret; }