[Xfce4-commits] [xfce/xfce4-settings] 44/67: display: WIP switch to profile treeview instead of combo
noreply at xfce.org
noreply at xfce.org
Sat Sep 22 11:23:35 CEST 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-settings.
commit 73ea90a4c5e2f2fc317666d5cde7a94dcbbe950c
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sat Sep 1 00:34:22 2018 +0200
display: WIP switch to profile treeview instead of combo
---
dialogs/display-settings/display-dialog.glade | 191 +++++++++++++++-----------
dialogs/display-settings/main.c | 35 ++---
2 files changed, 128 insertions(+), 98 deletions(-)
diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index 76b6865..3eddd82 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -398,74 +398,6 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="randr-profile">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="has_entry">True</property>
- <property name="entry_text_column">0</property>
- <child internal-child="entry">
- <object class="GtkEntry">
- <property name="can_focus">True</property>
- <property name="is_focus">True</property>
- <property name="margin_left">12</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">False</property>
- <property name="secondary_icon_sensitive">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <child>
- <object class="GtkButton" id="button-profile-delete">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Delete the currently selected display profile.</property>
- <property name="image">image1</property>
- <property name="always_show_image">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button-profile-save">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Save a new display profile or update an existing profile.</property>
- <property name="image">image2</property>
- <property name="always_show_image">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <style>
- <class name="linked"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="minimal-autoshow">
<property name="label" translatable="yes">Configure _new displays when connected</property>
<property name="visible">True</property>
@@ -497,20 +429,6 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="button-profile-apply">
- <property name="label" translatable="yes">Apply</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Apply the currently selected display profile.</property>
- <property name="always_show_image">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -536,6 +454,115 @@
</packing>
</child>
<child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">12</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkTreeView" id="randr-profile">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="border_width">1</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <style>
+ <class name="frame"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="button-profile-delete">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Delete the currently selected display profile.</property>
+ <property name="image">image1</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">-1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button-profile-apply">
+ <property name="label" translatable="yes">Apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Apply the currently selected display profile.</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button-profile-save">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Save a new display profile or update an existing profile.</property>
+ <property name="image">image2</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
<child>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index c139484..ee4e43a 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1344,27 +1344,36 @@ display_settings_minimal_profile_populate (GtkBuilder *builder)
}
static void
-display_settings_profile_combobox_populate (GtkBuilder *builder)
+display_settings_profile_list_populate (GtkBuilder *builder)
{
- guint m = 0;
GtkListStore *store;
- GObject *combobox;
+ GObject *treeview;
GtkTreeIter iter;
GList *profiles = NULL;
GList *current;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
/* create a new list store */
store = gtk_list_store_new (1,
G_TYPE_STRING);
/* set up the new combobox which will replace the above combobox */
- combobox = gtk_builder_get_object (builder, "randr-profile");
- gtk_combo_box_set_model (GTK_COMBO_BOX (combobox), GTK_TREE_MODEL (store));
+ treeview = gtk_builder_get_object (builder, "randr-profile");
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
+ column = gtk_tree_view_column_new ();
+ /* Setup renderer */
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_set_attributes (column, renderer, "text", COLUMN_COMBO_NAME, NULL);
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
profiles = display_settings_get_profiles ();
/* populate combobox */
- current = g_list_first(profiles);
+ current = g_list_first (profiles);
while (current)
{
gchar *property;
@@ -1382,13 +1391,8 @@ display_settings_profile_combobox_populate (GtkBuilder *builder)
current = g_list_next(current);
g_free (property);
g_free (profile_name);
- m++;
}
- /* If there is only one profile we auto-select and activate it */
- if (m == 1)
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-
/* Release the store */
g_list_free (profiles);
g_object_unref (G_OBJECT (store));
@@ -1530,7 +1534,7 @@ display_settings_profile_save (GtkWidget *widget, GtkBuilder *builder)
/* save the human-readable name of the profile as string value */
xfconf_channel_set_string (display_channel, property, profile);
- display_settings_profile_combobox_populate (builder);
+ display_settings_profile_list_populate (builder);
gtk_widget_set_sensitive (widget, FALSE);
g_free (property);
@@ -1632,7 +1636,7 @@ display_settings_profile_delete (GtkWidget *widget, GtkBuilder *builder)
g_string_prepend_c (property, '/');
xfconf_channel_reset_property (display_channel, property->str, True);
- display_settings_profile_combobox_populate (builder);
+ display_settings_profile_list_populate (builder);
gtk_entry_set_text (GTK_ENTRY (entry), "");
}
else {
@@ -1707,9 +1711,8 @@ display_settings_dialog_new (GtkBuilder *builder)
g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_rotations_changed), builder);
combobox = gtk_builder_get_object (builder, "randr-profile");
- display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
- g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_settings_profile_changed), builder);
+ //g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_settings_profile_changed), builder);
check = gtk_builder_get_object (builder, "minimal-autoshow");
xfconf_g_property_bind (display_channel, "/Notify", G_TYPE_BOOLEAN, check,
@@ -1733,7 +1736,7 @@ display_settings_dialog_new (GtkBuilder *builder)
/* Populate the combobox */
display_settings_combobox_populate (builder);
- display_settings_profile_combobox_populate (builder);
+ display_settings_profile_list_populate (builder);
return GTK_WIDGET (gtk_builder_get_object (builder, "display-dialog"));
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list