Visual changes, radiobutton for dpi stages

master
vhaudiquet 12 months ago
parent 6ed60bea1c
commit c535c91a48
  1. 29
      src/ui/panels/mouse-panel.c
  2. 149
      ui/panel-mouse.ui

@ -66,25 +66,32 @@ 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
char dpi_str[15];
sprintf(dpi_str, "%u DPI", dpi.level[i].dpi_x);
// 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);
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_check_button_set_active(radio_button, true);
if(dpi.level_current == i)
{
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(row), false);
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);
//gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(row), false);
adw_preferences_group_add(self->dpi_preference_group, GTK_WIDGET(row));
}
}

@ -5,87 +5,118 @@
<child type="content">
<object class="GtkBox">
<property name="halign">start</property>
<property name="spacing">10</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="hexpand">false</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="presentation_box">
<object class="GtkBox">
<property name="halign">start</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkImage" id="mouse_image">
<property name="halign">start</property>
<property name="height-request">250</property>
<property name="margin-top">30</property>
<property name="valign">start</property>
<property name="width-request">300</property>
<style />
</object>
</child>
<child>
<object class="GtkLabel" id="mouse_manufacturer">
<property name="halign">center</property>
<property name="justify">center</property>
<style>
<class name="heading" />
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="mouse_name">
<property name="halign">center</property>
<property name="justify">center</property>
<style>
<class name="heading" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="basic_settings">
<property name="halign">start</property>
<property name="margin-top">30</property>
<property name="orientation">vertical</property>
<property name="valign">start</property>
<property name="hexpand">false</property>
<child>
<object class="GtkLabel">
<object class="GtkBox" id="presentation_box">
<property name="halign">start</property>
<property name="label">Basic settings</property>
<property name="valign">start</property>
<style>
<class name="title-3" />
</style>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="mouse_image">
<property name="halign">start</property>
<property name="height-request">250</property>
<property name="margin-top">30</property>
<property name="valign">start</property>
<property name="width-request">300</property>
<style />
</object>
</child>
<child>
<object class="GtkLabel" id="mouse_manufacturer">
<property name="halign">center</property>
<property name="justify">center</property>
<style>
<class name="heading" />
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="mouse_name">
<property name="halign">center</property>
<property name="justify">center</property>
<style>
<class name="heading" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="dpi_box">
<object class="GtkBox" id="basic_settings">
<property name="halign">start</property>
<property name="margin-top">30</property>
<property name="orientation">vertical</property>
<property name="valign">start</property>
<property name="hexpand">false</property>
<child>
<object class="AdwPreferencesGroup" id="dpi_preference_group">
<property name="header-suffix">
<object class="GtkButton">
<property name="child">
<object class="AdwButtonContent" id="dpi_stage_add_button">
<property name="icon-name">list-add-symbolic</property>
<property name="label">1/1</property>
<property name="use-underline">True</property>
<object class="GtkBox" id="dpi_box">
<property name="halign">start</property>
<property name="margin-top">30</property>
<property name="valign">start</property>
<child>
<object class="AdwPreferencesGroup" id="dpi_preference_group">
<property name="height-request">200</property>
<property name="header-suffix">
<object class="GtkButton">
<property name="child">
<object class="AdwButtonContent" id="dpi_stage_add_button">
<property name="icon-name">list-add-symbolic</property>
<property name="label">1/1</property>
<property name="use-underline">True</property>
</object>
</property>
</object>
</property>
<property name="width-request">350</property>
<property name="title">DPI Stages</property>
<property name="description">DPI Stages of the mouse</property>
</object>
</property>
<property name="width-request">300</property>
<property name="title">DPI Stages</property>
<property name="description">DPI Stages of the mouse</property>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="halign">center</property>
<property name="margin-top">25</property>
<child>
<object class="AdwSwitchRow">
<property name="activatable">false</property>
<property name="width-request">200</property>
<property name="hexpand">false</property>
<property name="hexpand-set">true</property>
<property name="title">Motion sync</property>
<property name="subtitle">Motion sync makes the mouse send sensor data at
the rate of the computer update requests </property>
</object>
</child>
<child>
<object class="AdwSwitchRow">
<property name="activatable">false</property>
<property name="width-request">200</property>
<property name="hexpand">false</property>
<property name="hexpand-set">true</property>
<property name="title">Angle snap</property>
<property name="subtitle">Angle snap detects when you try to draw a straight
line and locks the mouse on that line</property>
</object>
</child>
</object>
</child>
</object>
</child>

Loading…
Cancel
Save