[Libreoffice-commits] core.git: dbaccess/uiconfig vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 9 11:36:25 UTC 2019


 dbaccess/uiconfig/ui/queryfilterdialog.ui |   20 +++++++++++---------
 vcl/unx/gtk3/gtk3gtkinst.cxx              |   28 ++++++++++++++++++----------
 2 files changed, 29 insertions(+), 19 deletions(-)

New commits:
commit d2313a5d052373f86174f9de4e24153024f6a8a2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 9 09:48:07 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 9 12:36:03 2019 +0100

    Resolves: tdf#122467 drop down field name is too narrow
    
    ellipise only when we have to
    
    Change-Id: I79820dc84fc9ac0a755700c70bca9edbb14cf371
    Reviewed-on: https://gerrit.libreoffice.org/66000
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/uiconfig/ui/queryfilterdialog.ui b/dbaccess/uiconfig/ui/queryfilterdialog.ui
index a52ea3651ba3..46164e2f503d 100644
--- a/dbaccess/uiconfig/ui/queryfilterdialog.ui
+++ b/dbaccess/uiconfig/ui/queryfilterdialog.ui
@@ -99,7 +99,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="queryfilterdialog|label2">Operator</property>
-                        <property name="ellipsize">end</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
@@ -112,7 +111,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="queryfilterdialog|label5">Field name</property>
-                        <property name="ellipsize">end</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -124,7 +122,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="queryfilterdialog|label6">Condition</property>
-                        <property name="ellipsize">end</property>
                       </object>
                       <packing>
                         <property name="left_attach">2</property>
@@ -135,7 +132,7 @@
                       <object class="GtkComboBoxText" id="field1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
+                        <property name="active">0</property>
                         <items>
                           <item translatable="yes" context="queryfilterdialog|field1">- none -</item>
                         </items>
@@ -150,6 +147,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
+                        <property name="active">0</property>
                         <items>
                           <item translatable="yes" context="queryfilterdialog|cond1">=</item>
                           <item translatable="yes" context="queryfilterdialog|cond1"><></item>
@@ -172,7 +170,7 @@
                       <object class="GtkComboBoxText" id="field2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
+                        <property name="active">0</property>
                         <items>
                           <item translatable="yes" context="queryfilterdialog|field2">- none -</item>
                         </items>
@@ -186,7 +184,7 @@
                       <object class="GtkComboBoxText" id="field3">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
+                        <property name="active">0</property>
                         <items>
                           <item translatable="yes" context="queryfilterdialog|field3">- none -</item>
                         </items>
@@ -201,6 +199,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
+                        <property name="active">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">2</property>
@@ -212,6 +211,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
+                        <property name="active">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">2</property>
@@ -223,7 +223,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="queryfilterdialog|label7">Value</property>
-                        <property name="ellipsize">end</property>
                       </object>
                       <packing>
                         <property name="left_attach">3</property>
@@ -234,6 +233,7 @@
                       <object class="GtkEntry" id="value1">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
                         <property name="activates_default">True</property>
                       </object>
                       <packing>
@@ -245,6 +245,7 @@
                       <object class="GtkEntry" id="value2">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
                         <property name="activates_default">True</property>
                       </object>
                       <packing>
@@ -256,6 +257,7 @@
                       <object class="GtkEntry" id="value3">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
                         <property name="activates_default">True</property>
                       </object>
                       <packing>
@@ -267,7 +269,7 @@
                       <object class="GtkComboBoxText" id="op2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
+                        <property name="active">0</property>
                         <items>
                           <item translatable="yes" context="queryfilterdialog|op2">AND</item>
                           <item translatable="yes" context="queryfilterdialog|op2">OR</item>
@@ -282,7 +284,7 @@
                       <object class="GtkComboBoxText" id="op3">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
+                        <property name="active">0</property>
                         <items>
                           <item translatable="yes" context="queryfilterdialog|op3">AND</item>
                           <item translatable="yes" context="queryfilterdialog|op3">OR</item>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 265a921f3f7c..b254a68cdae1 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6398,6 +6398,7 @@ class GtkInstanceComboBox : public GtkInstanceContainer, public vcl::ISearchable
 private:
     GtkComboBox* m_pComboBox;
     GtkTreeModel* m_pTreeModel;
+    GtkCellRenderer* m_pTextRenderer;
     GtkMenu* m_pMenu;
     std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter;
     vcl::QuickSelectionEngine m_aQuickSelectionEngine;
@@ -6710,23 +6711,19 @@ public:
         if (!g_list_length(cells))
         {
             //Always use the same text column renderer layout
-            GtkCellRenderer* text_renderer = gtk_cell_renderer_text_new();
-            gtk_cell_layout_pack_end(GTK_CELL_LAYOUT(m_pComboBox), text_renderer, true);
-            gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(m_pComboBox), text_renderer, "text", 0, nullptr);
-            g_object_set(G_OBJECT(text_renderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
+            m_pTextRenderer = gtk_cell_renderer_text_new();
+            gtk_cell_layout_pack_end(GTK_CELL_LAYOUT(m_pComboBox), m_pTextRenderer, true);
+            gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(m_pComboBox), m_pTextRenderer, "text", 0, nullptr);
         }
         else
         {
-            // this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let
-            // the popup menu render them in full, in the interim allow the text to wrap in both cases
-            GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
-            g_object_set(G_OBJECT(cell), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
+            m_pTextRenderer = static_cast<GtkCellRenderer*>(cells->data);
             if (g_list_length(cells) == 2)
             {
                 //The ComboBox is always going to show the column associated with
                 //the entry when there is one, left to its own devices this image
                 //column will be after it, but we want it before
-                gtk_cell_layout_reorder(GTK_CELL_LAYOUT(m_pComboBox), cell, 1);
+                gtk_cell_layout_reorder(GTK_CELL_LAYOUT(m_pComboBox), m_pTextRenderer, 1);
             }
         }
         g_list_free(cells);
@@ -6773,7 +6770,18 @@ public:
         GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
         GtkRequisition size;
         gtk_cell_renderer_get_preferred_size(cell, m_pWidget, &size, nullptr);
-        gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height);
+        if (nWidth < size.width)
+        {
+            // this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let
+            // the popup menu render them in full, in the interim ellipse both
+            g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
+            gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height);
+        }
+        else
+        {
+            g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_NONE, nullptr);
+            gtk_cell_renderer_set_fixed_size(cell, size.width, size.height);
+        }
         g_list_free(cells);
 
         gtk_widget_set_size_request(m_pWidget, nWidth, nHeight);


More information about the Libreoffice-commits mailing list