gridified the tab bar
This commit is contained in:
parent
5f5e84f7b1
commit
197e01d104
23
surf.c
23
surf.c
|
@ -388,16 +388,17 @@ void free_all_tabs(Client *client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* create_tab_bar_view(GList *tabs) {
|
GtkWidget* create_tab_bar_view(GList *tabs) {
|
||||||
GtkWidget *tab_bar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); //gtk_event_box_new();
|
GtkWidget *tab_bar = gtk_grid_new();
|
||||||
GdkRGBA black = { 0.138, 0.138, 0.138, 1 };
|
GdkRGBA black = { 0.138, 0.138, 0.138, 1 };
|
||||||
gtk_widget_override_background_color(tab_bar, GTK_STATE_FLAG_NORMAL, &black);
|
gtk_widget_override_background_color(tab_bar, GTK_STATE_FLAG_NORMAL, &black);
|
||||||
gtk_widget_set_size_request(tab_bar, -1, 28); // Set the height of the black bar
|
gtk_widget_set_size_request(tab_bar, -1, 16); // Set the height of the black bar
|
||||||
|
gtk_grid_set_column_spacing(tab_bar, 10);
|
||||||
//int num_tabs = g_list_length(tabs);
|
//int num_tabs = g_list_length(tabs);
|
||||||
//int num_parts = MAX(num_tabs + 1, 6); // Determine the number of parts (max(6, num_tabs + 1))
|
//int num_parts = MAX(num_tabs + 1, 6); // Determine the number of parts (max(6, num_tabs + 1))
|
||||||
|
|
||||||
//gtk_box_set_homogeneous(GTK_BOX(tab_bar), TRUE); // Make the box's children evenly spaced
|
//gtk_box_set_homogeneous(GTK_BOX(tab_bar), TRUE); // Make the box's children evenly spaced
|
||||||
|
|
||||||
|
|
||||||
// Add tabs to the tab bar
|
// Add tabs to the tab bar
|
||||||
for (GList *l = tabs; l != NULL; l = l->next) {
|
for (GList *l = tabs; l != NULL; l = l->next) {
|
||||||
Tab *tab = (Tab *)l->data;
|
Tab *tab = (Tab *)l->data;
|
||||||
|
@ -405,17 +406,21 @@ GtkWidget* create_tab_bar_view(GList *tabs) {
|
||||||
|
|
||||||
gtk_label_set_xalign(GTK_LABEL(label), 0.0);
|
gtk_label_set_xalign(GTK_LABEL(label), 0.0);
|
||||||
gtk_widget_set_margin_start(label, 5);
|
gtk_widget_set_margin_start(label, 5);
|
||||||
|
gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
|
||||||
// Set the size request for each tab to ensure they are evenly distributed
|
// Set the size request for each tab to ensure they are evenly distributed
|
||||||
//gtk_widget_set_size_request(label, -1, -1); // Default size request for label
|
//gtk_widget_set_size_request(label, -1, -1); // Default size request for label
|
||||||
gtk_box_pack_start(GTK_BOX(tab_bar), label, TRUE, TRUE, 0); // Pack the label into the box
|
gtk_grid_attach_next_to(GTK_GRID(tab_bar), label, NULL, GTK_POS_RIGHT, 1, 1); // Pack the label into the box
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an empty spacer to ensure space for the last tab
|
// Add an empty spacer to ensure space for the last tab
|
||||||
GtkWidget *spacer = gtk_label_new("+"); // Create an empty label as a spacer
|
GtkWidget *new_tab = gtk_label_new("+"); // Create an empty label as a spacer
|
||||||
gtk_widget_set_size_request(spacer, -1, -1); // Default size request for spacer
|
gtk_grid_attach_next_to(GTK_GRID(tab_bar), new_tab, NULL, GTK_POS_RIGHT, 1, 1);
|
||||||
gtk_box_pack_start(GTK_BOX(tab_bar), spacer, TRUE, TRUE, 0);
|
gtk_widget_show(new_tab);
|
||||||
gtk_widget_show(spacer);
|
|
||||||
|
// GtkWidget *spacer = gtk_label_new("+");
|
||||||
|
// gtk_attach_next_to(GTK_GRID(tab_bar), spacer, NULL, GTK_POS_RIGHT, 1, 1);
|
||||||
|
// gtk_widget_show(spacer);
|
||||||
|
|
||||||
return tab_bar;
|
return tab_bar;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue