tweaks: redirect wikipedia to wikiless & add max tab title length.
This commit is contained in:
parent
4da5aad23e
commit
4958d9eeaa
|
@ -34,7 +34,8 @@ int libre_redirect(const char* uri, char* output){
|
||||||
"https://translate.google.com",
|
"https://translate.google.com",
|
||||||
"https://forum.effectivealtruism.org",
|
"https://forum.effectivealtruism.org",
|
||||||
"https://www.bloomberg.com",
|
"https://www.bloomberg.com",
|
||||||
"https://twitter.com"
|
"https://twitter.com",
|
||||||
|
"https://wikipedia.org"
|
||||||
};
|
};
|
||||||
char* alternatives[] = {
|
char* alternatives[] = {
|
||||||
"https://yt.artemislena.eu",
|
"https://yt.artemislena.eu",
|
||||||
|
@ -43,7 +44,8 @@ int libre_redirect(const char* uri, char* output){
|
||||||
"https://simplytranslate.org/",
|
"https://simplytranslate.org/",
|
||||||
"https://ea.greaterwrong.com",
|
"https://ea.greaterwrong.com",
|
||||||
"https://archive.is/https://www.bloomberg.com",
|
"https://archive.is/https://www.bloomberg.com",
|
||||||
"https://nitter.net"
|
"https://nitter.net",
|
||||||
|
"https://wikiless.org"
|
||||||
};
|
};
|
||||||
int n = sizeof(annoying_sites)/sizeof(annoying_sites[0]);
|
int n = sizeof(annoying_sites)/sizeof(annoying_sites[0]);
|
||||||
for(int i=0; i<n ; i++){
|
for(int i=0; i<n ; i++){
|
||||||
|
|
16
rose.c
16
rose.c
|
@ -115,9 +115,21 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_FINISHED:
|
case WEBKIT_LOAD_FINISHED:
|
||||||
{
|
{
|
||||||
const char* title = webkit_web_view_get_title(self);
|
const char* webpage_title = webkit_web_view_get_title(self);
|
||||||
|
const int max_length = 25;
|
||||||
|
char tab_title[max_length + 1];
|
||||||
|
if(webpage_title != NULL){
|
||||||
|
for(int i = 0; i<(max_length); i++){
|
||||||
|
tab_title[i] = webpage_title[i];
|
||||||
|
if(webpage_title[i] == '\0'){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tab_title[max_length] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
gtk_notebook_set_tab_label_text(notebook, GTK_WIDGET(self),
|
gtk_notebook_set_tab_label_text(notebook, GTK_WIDGET(self),
|
||||||
title == NULL ? "—" : title );
|
webpage_title == NULL ? "—" : tab_title );
|
||||||
// gtk_widget_hide(GTK_WIDGET(bar));
|
// gtk_widget_hide(GTK_WIDGET(bar));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user