[gnome-control-center] info: Make the Removable Media panel adaptive
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] info: Make the Removable Media panel adaptive
- Date: Mon, 22 Jul 2019 21:46:52 +0000 (UTC)
commit f80f1d63fdad592fefbe8dc9770c737cbf6eba18
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Feb 19 15:07:01 2019 +0100
info: Make the Removable Media panel adaptive
Wrap or ellipsize the labels to allow the panel to fit in narrower
windows.
panels/info/cc-info-removable-media-panel.c | 19 +++++++++++++++++++
panels/info/cc-info-removable-media-panel.ui | 16 ++++++++++++----
2 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/panels/info/cc-info-removable-media-panel.c b/panels/info/cc-info-removable-media-panel.c
index fea667ceb..0ea0f5869 100644
--- a/panels/info/cc-info-removable-media-panel.c
+++ b/panels/info/cc-info-removable-media-panel.c
@@ -84,6 +84,17 @@ struct _CcInfoRemovableMediaPanel
G_DEFINE_TYPE (CcInfoRemovableMediaPanel, cc_info_removable_media_panel, CC_TYPE_PANEL)
+static void
+ellipsize_cell_layout (GtkCellLayout *cell_layout)
+{
+ g_autoptr(GList) cells = gtk_cell_layout_get_cells (cell_layout);
+ GList *cell;
+
+ for (cell = cells; cell; cell = cell->next)
+ if (GTK_IS_CELL_RENDERER_TEXT (cell->data))
+ g_object_set (G_OBJECT (cell->data), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+}
+
static char **
remove_elem_from_str_array (char **v,
const char *s)
@@ -353,6 +364,7 @@ other_type_combo_box_changed (GtkComboBox *combo_box,
}
self->other_application_combo = gtk_app_chooser_button_new (x_content_type);
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->other_application_combo));
gtk_box_pack_start (GTK_BOX (action_container), self->other_application_combo, TRUE, TRUE, 0);
prepare_combo_box (self, self->other_application_combo, NULL);
gtk_widget_show (self->other_application_combo);
@@ -600,5 +612,12 @@ cc_info_removable_media_panel_init (CcInfoRemovableMediaPanel *self)
gtk_widget_init_template (GTK_WIDGET (self));
self->media_settings = g_settings_new (MEDIA_HANDLING_SCHEMA);
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->media_audio_cdda_combobox));
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->media_video_dvd_combobox));
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->media_music_player_combobox));
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->media_dcf_combobox));
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->media_software_combobox));
+ ellipsize_cell_layout (GTK_CELL_LAYOUT (self->media_other_type_combobox));
+
info_panel_setup_media (self);
}
diff --git a/panels/info/cc-info-removable-media-panel.ui b/panels/info/cc-info-removable-media-panel.ui
index a9239ec00..c0b93bfaa 100644
--- a/panels/info/cc-info-removable-media-panel.ui
+++ b/panels/info/cc-info-removable-media-panel.ui
@@ -39,7 +39,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
- <property name="xalign">0</property>
+ <property name="justify">center</property>
+ <property name="wrap">True</property>
<property name="label" translatable="yes">Select how media should be
handled</property>
<property name="margin_bottom">12</property>
<style>
@@ -269,16 +270,23 @@
</child>
<child>
<object class="GtkCheckButton" id="media_autorun_never_checkbutton">
- <property name="label" translatable="yes">_Never prompt or start programs on media
insertion</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="valign">end</property>
<property name="vexpand">False</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="wrap">True</property>
+ <property name="xalign">0</property>
+ <property name="use_underline">True</property>
+ <property name="label" translatable="yes">_Never prompt or start programs on media
insertion</property>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]