Visual changes, radiobutton for dpi stages

This commit is contained in:
2023-09-29 15:50:38 +02:00
parent 6ed60bea1c
commit c535c91a48
2 changed files with 116 additions and 78 deletions
+18 -11
View File
@@ -66,24 +66,31 @@ void mouse_panel_set_device(MousePanel* self, device_t* device)
sprintf(dpi_used_max, "%u/%u", dpi.level_count, dpi.max_level_count);
adw_button_content_set_label(self->dpi_stage_add_button, dpi_used_max);
GtkCheckButton* group = 0;
// Set dpi list
for(size_t i = 0; i < dpi.level_count; i++)
{
AdwPreferencesRow* row = ADW_PREFERENCES_ROW(adw_preferences_row_new());
AdwActionRow* row = ADW_ACTION_ROW(adw_action_row_new());
// Convert dpi int to string
// Add radiobutton
if(dpi.level_count > 1)
{
GtkCheckButton* radio_button = GTK_CHECK_BUTTON(gtk_check_button_new());
if(!group) group = radio_button;
else gtk_check_button_set_group(radio_button, group);
if(dpi.level_current == i)
gtk_check_button_set_active(radio_button, true);
adw_action_row_add_prefix(row, GTK_WIDGET(radio_button));
}
// Convert dpi int to string, and set it as title
char dpi_str[15];
sprintf(dpi_str, "%u DPI", dpi.level[i].dpi_x);
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(row), dpi_str);
GtkLabel* label = GTK_LABEL(gtk_label_new(dpi_str));
gtk_widget_set_margin_top(GTK_WIDGET(label), 10);
gtk_widget_set_margin_bottom(GTK_WIDGET(label), 10);
gtk_list_box_row_set_child(GTK_LIST_BOX_ROW(row), GTK_WIDGET(label));
if(dpi.level_current == i)
{
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(row), false);
}
//gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(row), false);
adw_preferences_group_add(self->dpi_preference_group, GTK_WIDGET(row));
}