diff options
author | Christopher Davis <christopherdavis@gnome.org> | 2022-02-12 15:17:20 -0800 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2022-02-13 13:33:25 +0000 |
commit | 530fbac68e061c4e0f63968641e19beddfc50c5f (patch) | |
tree | d30d5d23a748097fba772943a0e29132f9dd5a12 | |
parent | 485dd456bbed351d0605c94dcb5ceb50c8eeb4f5 (diff) | |
download | gnome-control-center-530fbac68e061c4e0f63968641e19beddfc50c5f.tar.gz |
keyboard: Subclass AdwActionRow for InputRow
-rw-r--r-- | panels/keyboard/cc-input-row.c | 8 | ||||
-rw-r--r-- | panels/keyboard/cc-input-row.h | 3 | ||||
-rw-r--r-- | panels/keyboard/cc-input-row.ui | 57 |
3 files changed, 22 insertions, 46 deletions
diff --git a/panels/keyboard/cc-input-row.c b/panels/keyboard/cc-input-row.c index b452209f4..60e1cec21 100644 --- a/panels/keyboard/cc-input-row.c +++ b/panels/keyboard/cc-input-row.c @@ -21,11 +21,10 @@ struct _CcInputRow { - GtkListBoxRow parent_instance; + AdwActionRow parent_instance; CcInputSource *source; - GtkLabel *name_label; GtkButton *remove_button; GtkButton *settings_button; GtkSeparator *settings_separator; @@ -37,7 +36,7 @@ struct _CcInputRow gdouble drag_y; }; -G_DEFINE_TYPE (CcInputRow, cc_input_row, GTK_TYPE_LIST_BOX_ROW) +G_DEFINE_TYPE (CcInputRow, cc_input_row, ADW_TYPE_ACTION_ROW) enum { @@ -185,7 +184,6 @@ cc_input_row_class_init (CcInputRowClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/keyboard/cc-input-row.ui"); - gtk_widget_class_bind_template_child (widget_class, CcInputRow, name_label); gtk_widget_class_bind_template_child (widget_class, CcInputRow, remove_button); gtk_widget_class_bind_template_child (widget_class, CcInputRow, settings_button); gtk_widget_class_bind_template_child (widget_class, CcInputRow, settings_separator); @@ -260,7 +258,7 @@ static void label_changed_cb (CcInputRow *self) { g_autofree gchar *label = cc_input_source_get_label (self->source); - gtk_label_set_text (self->name_label, label); + adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), label); } CcInputRow * diff --git a/panels/keyboard/cc-input-row.h b/panels/keyboard/cc-input-row.h index 5d78337e6..666bcb6c4 100644 --- a/panels/keyboard/cc-input-row.h +++ b/panels/keyboard/cc-input-row.h @@ -17,6 +17,7 @@ #pragma once +#include <adwaita.h> #include <gtk/gtk.h> #include <gio/gdesktopappinfo.h> @@ -25,7 +26,7 @@ G_BEGIN_DECLS #define CC_TYPE_INPUT_ROW (cc_input_row_get_type ()) -G_DECLARE_FINAL_TYPE (CcInputRow, cc_input_row, CC, INPUT_ROW, GtkListBoxRow) +G_DECLARE_FINAL_TYPE (CcInputRow, cc_input_row, CC, INPUT_ROW, AdwActionRow) CcInputRow *cc_input_row_new (CcInputSource *source); diff --git a/panels/keyboard/cc-input-row.ui b/panels/keyboard/cc-input-row.ui index 0fdcda0fd..79d73137b 100644 --- a/panels/keyboard/cc-input-row.ui +++ b/panels/keyboard/cc-input-row.ui @@ -1,47 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="3.20"/> - <template class="CcInputRow" parent="GtkListBoxRow"> + <template class="CcInputRow" parent="AdwActionRow"> <property name="selectable">False</property> - <child> - <object class="GtkBox"> - <property name="height_request">50</property> - <property name="margin_start">12</property> - <property name="margin_end">6</property> - <property name="spacing">12</property> - <child> - <object class="GtkImage"> - <property name="icon_name">list-drag-handle-symbolic</property> - <style> - <class name="drag-handle"/> - </style> - </object> - </child> - <child> - <object class="GtkLabel" id="name_label"> - <property name="margin_bottom">8</property> - <property name="margin_top">8</property> - <property name="ellipsize">end</property> - <property name="xalign">0.0</property> - <property name="hexpand">True</property> - </object> - </child> - <child> - <object class="GtkMenuButton"> - <property name="margin_bottom">8</property> - <property name="margin_top">8</property> - <property name="valign">center</property> - <property name="popover">popover_menu</property> - <style> - <class name="flat"/> - </style> - <child> - <object class="GtkImage"> - <property name="icon_name">view-more-symbolic</property> - </object> - </child> - </object> - </child> + <child type="prefix"> + <object class="GtkImage"> + <property name="icon_name">list-drag-handle-symbolic</property> + <style> + <class name="drag-handle"/> + </style> + </object> + </child> + <child type="suffix"> + <object class="GtkMenuButton"> + <property name="valign">center</property> + <property name="icon_name">view-more-symbolic</property> + <property name="popover">popover_menu</property> + <style> + <class name="flat"/> + </style> </object> </child> </template> |