diff options
author | NunoSempere <nuno.sempere@protonmail.com> | 2023-02-05 02:52:27 +0100 |
---|---|---|
committer | NunoSempere <nuno.sempere@protonmail.com> | 2023-02-05 02:52:27 +0100 |
commit | 6b3c830c3b6e9337abe8a93fd3704a3b2d3148bb (patch) | |
tree | 2f610138cda5698b2ce7fcee799182ad1883d232 | |
parent | 4fd1c836602a598112d6abbb00d7305fdd9385db (diff) |
tweak: add two style improvements that I consider unambiguous
1. Make top tab wider
2. Make tab title have a maximum width
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | rose.c | 20 |
2 files changed, 17 insertions, 4 deletions
@@ -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 @@ -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); |