tweak: add two style improvements that I consider unambiguous

1. Make top tab wider
2. Make tab title have a maximum width
This commit is contained in:
NunoSempere 2023-02-05 02:52:27 +01:00
parent 4fd1c83660
commit 6b3c830c3b
2 changed files with 17 additions and 4 deletions

View File

@ -23,4 +23,5 @@ Rose is released under own license, which grants the following permissions:
- [x] Add open in new tab functionality
- [x] Test open in new tab functionality
- [x] Add styles tab
- [ ] Isolate plugins so that they aren't active by default

22
rose.c
View File

@ -106,13 +106,25 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *
break;
case WEBKIT_LOAD_FINISHED:
{
const char* title = webkit_web_view_get_title(self);
gtk_notebook_set_tab_label_text(notebook, GTK_WIDGET(self),
title == NULL ? "" : title );
// gtk_widget_hide(GTK_WIDGET(bar));
/* Add gtk tab title */
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),
webpage_title == NULL ? "" : tab_title );
// gtk_widget_hide(GTK_WIDGET(bar));
}
}
}
void notebook_append(GtkNotebook *notebook, const char *uri);
@ -330,7 +342,7 @@ void window_init(GtkNotebook *notebook)
800);
gtk_entry_buffer_new("", 0);
gtk_entry_set_alignment(search, 0.48);
gtk_widget_set_size_request(GTK_WIDGET(search), 300, -1);
gtk_widget_set_size_request(GTK_WIDGET(search), 1200, -1);
gtk_header_bar_set_custom_title(bar, GTK_WIDGET(search));
gtk_window_set_titlebar(window, GTK_WIDGET(bar));
g_signal_connect(search, "activate", G_CALLBACK(search_activate), notebook);