project: Remove most can-focus properties

In GTK4, can-focus usage is much more specific to widget subclasses,
and in almost all cases it's not necessary to set it.

Remove it everywhere, except in one case where it still needs to be
manually set to False.
This commit is contained in:
Georges Basile Stavracas Neto 2022-07-08 10:33:05 -03:00
parent 5bec6e8fdc
commit 262d6a6e7a
4 changed files with 2 additions and 16 deletions

View File

@ -36,7 +36,6 @@
<property name="subtitle_lines">0</property> <property name="subtitle_lines">0</property>
<child> <child>
<object class="GtkSwitch" id="restrict_web_browsers_switch"> <object class="GtkSwitch" id="restrict_web_browsers_switch">
<property name="can_focus">True</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<signal name="notify::active" handler="on_restrict_web_browsers_switch_active_changed_cb" object="MctUserControls" swapped="no" /> <signal name="notify::active" handler="on_restrict_web_browsers_switch_active_changed_cb" object="MctUserControls" swapped="no" />
@ -85,7 +84,6 @@
<property name="subtitle_lines">0</property> <property name="subtitle_lines">0</property>
<child> <child>
<object class="GtkSwitch" id="restrict_software_installation_switch"> <object class="GtkSwitch" id="restrict_software_installation_switch">
<property name="can_focus">True</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<signal name="notify::active" handler="on_restrict_installation_switch_active_changed_cb" object="MctUserControls" swapped="no" /> <signal name="notify::active" handler="on_restrict_installation_switch_active_changed_cb" object="MctUserControls" swapped="no" />
@ -106,7 +104,6 @@
<property name="subtitle_lines">0</property> <property name="subtitle_lines">0</property>
<child> <child>
<object class="GtkMenuButton" id="oars_button"> <object class="GtkMenuButton" id="oars_button">
<property name="can_focus">True</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="direction">right</property> <property name="direction">right</property>

View File

@ -427,12 +427,7 @@ update_main_stack (MctApplication *self)
gtk_stack_set_visible_child_name (self->main_stack, new_page_name); gtk_stack_set_visible_child_name (self->main_stack, new_page_name);
if (new_focus_widget != NULL && !g_str_equal (old_page_name, new_page_name)) if (new_focus_widget != NULL && !g_str_equal (old_page_name, new_page_name))
{ gtk_widget_grab_focus (new_focus_widget);
if (gtk_widget_get_can_focus (new_focus_widget))
gtk_widget_grab_focus (new_focus_widget);
else
gtk_widget_child_focus (new_focus_widget, GTK_DIR_TAB_FORWARD);
}
} }
static void static void

View File

@ -28,14 +28,12 @@
<child> <child>
<object class="GtkButton" id="go_back_button"> <object class="GtkButton" id="go_back_button">
<property name="visible">False</property> <property name="visible">False</property>
<property name="can_focus">True</property>
<property name="valign">center</property> <property name="valign">center</property>
<style> <style>
<class name="circular"/> <class name="circular"/>
</style> </style>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="can_focus">False</property>
<property name="icon-size">4</property> <property name="icon-size">4</property>
<property name="icon_name">go-previous-symbolic</property> <property name="icon_name">go-previous-symbolic</property>
<child internal-child="accessible"> <child internal-child="accessible">
@ -53,14 +51,12 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="go_next_button"> <object class="GtkButton" id="go_next_button">
<property name="can_focus">True</property>
<property name="valign">center</property> <property name="valign">center</property>
<style> <style>
<class name="circular"/> <class name="circular"/>
</style> </style>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="can_focus">False</property>
<property name="icon-size">4</property> <property name="icon-size">4</property>
<property name="icon_name">go-next-symbolic</property> <property name="icon_name">go-next-symbolic</property>
<child internal-child="accessible"> <child internal-child="accessible">
@ -80,6 +76,7 @@
</child> </child>
<child type="overlay"> <child type="overlay">
<object class="GtkBox"> <object class="GtkBox">
<property name="can-focus">False</property>
<property name="valign">GTK_ALIGN_END</property> <property name="valign">GTK_ALIGN_END</property>
<style> <style>
<class name="carousel-arrow-container"/> <class name="carousel-arrow-container"/>

View File

@ -16,7 +16,6 @@
<child> <child>
<object class="GtkMenuButton" id="primary_menu"> <object class="GtkMenuButton" id="primary_menu">
<property name="direction">none</property> <property name="direction">none</property>
<property name="can-focus">True</property>
<property name="use-popover">True</property> <property name="use-popover">True</property>
<property name="menu-model">primary-menu</property> <property name="menu-model">primary-menu</property>
<accelerator key="F10" signal="activate"/> <accelerator key="F10" signal="activate"/>
@ -76,7 +75,6 @@
<property name="halign">center</property> <property name="halign">center</property>
<property name="can-default">True</property> <property name="can-default">True</property>
<property name="has-default">True</property> <property name="has-default">True</property>
<property name="can-focus">True</property>
</object> </object>
</child> </child>
</object> </object>
@ -98,7 +96,6 @@
<property name="can-default">True</property> <property name="can-default">True</property>
<property name="has-default">True</property> <property name="has-default">True</property>
<property name="use-underline">True</property> <property name="use-underline">True</property>
<property name="can-focus">True</property>
<style> <style>
<class name="suggested-action"/> <class name="suggested-action"/>
</style> </style>