diff --git a/panels/keyboard/cc-keyboard-shortcut-dialog.c b/panels/keyboard/cc-keyboard-shortcut-dialog.c index c41787eb3..a6814a3b2 100644 --- a/panels/keyboard/cc-keyboard-shortcut-dialog.c +++ b/panels/keyboard/cc-keyboard-shortcut-dialog.c @@ -25,7 +25,6 @@ */ #include -#define HANDY_USE_UNSTABLE_API #include #include "cc-keyboard-shortcut-dialog.h" @@ -136,42 +135,21 @@ add_section (CcKeyboardShortcutDialog *self, const gchar *section_id, const gchar *section_title) { - GtkWidget *icon, *modified_label, *label, *box; - GtkListBoxRow *row; + GtkWidget *icon, *modified_label, *row; - icon = g_object_new (GTK_TYPE_IMAGE, - "visible", 1, - "icon_name", "go-next-symbolic", - NULL); + icon = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_BUTTON); gtk_style_context_add_class (gtk_widget_get_style_context (icon), "dim-label"); - modified_label = g_object_new (GTK_TYPE_LABEL, - "visible", 1, - NULL); + modified_label = gtk_label_new (NULL); gtk_style_context_add_class (gtk_widget_get_style_context (modified_label), "dim-label"); - label = g_object_new (GTK_TYPE_LABEL, - "visible", 1, - "label", _(section_title), - NULL); - gtk_style_context_add_class (gtk_widget_get_style_context (label), "row-label"); + row = hdy_action_row_new (); + gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), TRUE); + hdy_preferences_row_set_title (HDY_PREFERENCES_ROW (row), _(section_title)); + gtk_container_add (GTK_CONTAINER (row), modified_label); + gtk_container_add (GTK_CONTAINER (row), icon); - box = g_object_new (GTK_TYPE_BOX, - "visible", 1, - "spacing", 8, - "margin_left", 12, - "margin_right", 12, - "margin_top", 8, - "margin_bottom", 8, - NULL); - gtk_container_add (GTK_CONTAINER (box), label); - gtk_box_pack_end (GTK_BOX (box), icon, FALSE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (box), modified_label, FALSE, FALSE, 0); - - row = g_object_new (GTK_TYPE_LIST_BOX_ROW, - "visible", 1, - NULL); - gtk_container_add (GTK_CONTAINER (row), box); + gtk_widget_show_all (GTK_WIDGET (row)); g_object_set_data_full (G_OBJECT (row), "data", @@ -181,7 +159,7 @@ add_section (CcKeyboardShortcutDialog *self, g_hash_table_insert (self->sections, g_strdup (section_id), row); gtk_container_add (GTK_CONTAINER (self->section_listbox), GTK_WIDGET (row)); - return row; + return GTK_LIST_BOX_ROW (row); } static void diff --git a/panels/keyboard/cc-keyboard-shortcut-row.c b/panels/keyboard/cc-keyboard-shortcut-row.c index 6bb91d3ca..f8b901890 100644 --- a/panels/keyboard/cc-keyboard-shortcut-row.c +++ b/panels/keyboard/cc-keyboard-shortcut-row.c @@ -24,10 +24,9 @@ struct _CcKeyboardShortcutRow { - GtkListBoxRow parent_instance; + HdyActionRow parent_instance; GtkLabel *accelerator_label; - GtkLabel *description_label; GtkButton *reset_button; CcKeyboardItem *item; @@ -35,7 +34,7 @@ struct _CcKeyboardShortcutRow CcKeyboardShortcutEditor *shortcut_editor; }; -G_DEFINE_TYPE (CcKeyboardShortcutRow, cc_keyboard_shortcut_row, GTK_TYPE_LIST_BOX_ROW) +G_DEFINE_TYPE (CcKeyboardShortcutRow, cc_keyboard_shortcut_row, HDY_TYPE_ACTION_ROW) static void reset_shortcut_cb (CcKeyboardShortcutRow *self) @@ -50,7 +49,6 @@ cc_keyboard_shortcut_row_class_init (CcKeyboardShortcutRowClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/keyboard/cc-keyboard-shortcut-row.ui"); - gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutRow, description_label); gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutRow, accelerator_label); gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutRow, reset_button); @@ -115,7 +113,7 @@ cc_keyboard_shortcut_row_new (CcKeyboardItem *item, self->manager = manager; self->shortcut_editor = shortcut_editor; - gtk_label_set_text (self->description_label, cc_keyboard_item_get_description (item)); + hdy_preferences_row_set_title (HDY_PREFERENCES_ROW (self), cc_keyboard_item_get_description (item)); g_object_bind_property_full (item, "key-combos", diff --git a/panels/keyboard/cc-keyboard-shortcut-row.h b/panels/keyboard/cc-keyboard-shortcut-row.h index d11143f73..919d2acdc 100644 --- a/panels/keyboard/cc-keyboard-shortcut-row.h +++ b/panels/keyboard/cc-keyboard-shortcut-row.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include "cc-keyboard-item.h" #include "cc-keyboard-manager.h" #include "cc-keyboard-shortcut-editor.h" @@ -29,7 +30,7 @@ G_BEGIN_DECLS #define CC_TYPE_KEYBOARD_SHORTCUT_ROW (cc_keyboard_shortcut_row_get_type()) -G_DECLARE_FINAL_TYPE (CcKeyboardShortcutRow, cc_keyboard_shortcut_row, CC, KEYBOARD_SHORTCUT_ROW, GtkListBoxRow) +G_DECLARE_FINAL_TYPE (CcKeyboardShortcutRow, cc_keyboard_shortcut_row, CC, KEYBOARD_SHORTCUT_ROW, HdyActionRow) CcKeyboardShortcutRow *cc_keyboard_shortcut_row_new (CcKeyboardItem*, CcKeyboardManager*, CcKeyboardShortcutEditor*, GtkSizeGroup*); diff --git a/panels/keyboard/cc-keyboard-shortcut-row.ui b/panels/keyboard/cc-keyboard-shortcut-row.ui index 87a52d77a..7a79db6d7 100644 --- a/panels/keyboard/cc-keyboard-shortcut-row.ui +++ b/panels/keyboard/cc-keyboard-shortcut-row.ui @@ -1,57 +1,38 @@ -