From 6b3c830c3b6e9337abe8a93fd3704a3b2d3148bb Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 5 Feb 2023 02:52:27 +0100 Subject: tweak: add two style improvements that I consider unambiguous 1. Make top tab wider 2. Make tab title have a maximum width --- README.md | 1 + rose.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fb63296..241effa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/rose.c b/rose.c index 93a4ccd..01753e3 100644 --- a/rose.c +++ b/rose.c @@ -106,11 +106,23 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook * break; case WEBKIT_LOAD_FINISHED: { - const char* title = webkit_web_view_get_title(self); + /* 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), - title == NULL ? "—" : title ); + webpage_title == NULL ? "—" : tab_title ); // gtk_widget_hide(GTK_WIDGET(bar)); - break; } } } @@ -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); -- cgit v1.2.3