[krb5-auth-dialog] main-window: Ellipsizse text columns
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] main-window: Ellipsizse text columns
- Date: Fri, 12 Feb 2021 08:50:29 +0000 (UTC)
commit 48a77c86f1b845580a203115adb9a0faf3b85db5
Author: Guido Günther <agx sigxcpu org>
Date: Tue Feb 9 14:15:44 2021 +0100
main-window: Ellipsizse text columns
This allows to fit on smaller screens. Set a default-width on the main
window so we don't start up too narrow and ellipsize the principal when
there's enough space.
src/ka-main-window.c | 13 +++++++++++--
src/resources/ui/ka-main-window.ui | 4 ++--
2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/ka-main-window.c b/src/ka-main-window.c
index 652228c..f975ab9 100644
--- a/src/ka-main-window.c
+++ b/src/ka-main-window.c
@@ -69,6 +69,7 @@ GtkApplicationWindow *
ka_main_window_create (KaApplet *applet)
{
GtkCellRenderer *text_renderer, *toggle_renderer;
+ GtkTreeViewColumn *column;
GtkTreeView *tickets_view;
GtkBuilder *builder;
@@ -92,6 +93,9 @@ ka_main_window_create (KaApplet *applet)
GTK_TREE_MODEL (tickets));
text_renderer = gtk_cell_renderer_text_new ();
+ g_object_set (text_renderer,
+ "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
+ NULL);
toggle_renderer = gtk_cell_renderer_toggle_new ();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tickets_view), -1,
@@ -101,13 +105,13 @@ ka_main_window_create (KaApplet *applet)
PRINCIPAL_COLUMN,
NULL);
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tickets_view), -1,
- _("Start Time"),
+ _("Start"),
text_renderer,
"text",
START_TIME_COLUMN,
NULL);
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tickets_view), -1,
- _("End Time"),
+ _("End"),
text_renderer,
"markup",
END_TIME_COLUMN,
@@ -134,6 +138,11 @@ ka_main_window_create (KaApplet *applet)
RENEWABLE_COLUMN,
NULL);
+ for (int i = PRINCIPAL_COLUMN; i <= END_TIME_COLUMN; i++) {
+ column = gtk_tree_view_get_column(tickets_view, i);
+ g_object_set (column, "expand", TRUE, NULL);
+ }
+
g_signal_connect (applet, "krb-ccache-changed",
G_CALLBACK(ccache_changed_cb),
NULL);
diff --git a/src/resources/ui/ka-main-window.ui b/src/resources/ui/ka-main-window.ui
index 985e81b..427f8a7 100644
--- a/src/resources/ui/ka-main-window.ui
+++ b/src/resources/ui/ka-main-window.ui
@@ -48,6 +48,7 @@
<property name="can_focus">False</property>
<property name="title" translatable="yes">Service Tickets</property>
<property name="window_position">center</property>
+ <property name="default-width">700</property>
<signal name="delete-event" handler="ka_main_window_hide" swapped="no"/>
<child>
<object class="GtkGrid" id="grid1">
@@ -58,8 +59,7 @@
<object class="GtkTreeView" id="krb5_tickets_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="vexpand">True</property>
- <property name="hexpand">True</property>
+ <property name="expand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]