search bar/xed-history-entry: Set a 'width-chars' on the GtkEntry

widgets of the search and replace entry widgets, and allow their
labels to ellipsize upon resizing.

This allows the entry widgets to have a smaller minimum size, which
was having an impact on window tiling for certain locales and display
resolutions (muffin and other wm's won't allow tiling of a window
if the resulting window size is less than the minimum size hints
reported by gtk and other toolkits.)

Ellipsizing the labels has the same benefit of enabling xed to be
resized smaller to tile on smaller displays.  This ellipsizing only
occurs once the entries hit their minimum size.

Fixes #73
This commit is contained in:
Michael Webster 2018-07-06 14:40:07 -04:00
parent 4f43977c59
commit dfcf007a44
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.0 -->
<!--*- mode: xml -*-->
<interface>
<requires lib="gtk+" version="3.12"/>
@ -58,6 +58,7 @@
<property name="vexpand">False</property>
<property name="label" translatable="yes">_Search for: </property>
<property name="use_underline">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
</object>
<packing>
@ -71,6 +72,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">Replace _with: </property>
<property name="use_underline">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
</object>
<packing>
@ -252,5 +254,8 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View File

@ -473,6 +473,7 @@ xed_history_entry_new (const gchar *history_id,
gboolean enable_completion)
{
GtkWidget *ret;
GtkEntry *real_entry;
g_return_val_if_fail (history_id != NULL, NULL);
@ -498,6 +499,9 @@ xed_history_entry_new (const gchar *history_id,
xed_history_entry_set_enable_completion (XED_HISTORY_ENTRY (ret), enable_completion);
real_entry = GTK_ENTRY (xed_history_entry_get_entry (XED_HISTORY_ENTRY (ret)));
gtk_entry_set_width_chars (real_entry, 6);
return ret;
}