Allow to click on heading to ellipsize it
This commit is contained in:
parent
eeb9d87cc3
commit
6555b8d8e2
@ -318,15 +318,20 @@
|
||||
<property name="margin_top">2</property>
|
||||
<property name="margin_bottom">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="labelSummary">
|
||||
<object class="GtkEventBox" id="summaryEventBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Please select an entry in the list above.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="1.3999999999999999"/>
|
||||
</attributes>
|
||||
<child>
|
||||
<object class="GtkLabel" id="labelSummary">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Please select an entry in the list above.</property>
|
||||
<property name="wrap">True</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="1.3999999999999999"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -412,6 +412,11 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
||||
"clicked",
|
||||
(GCallback) mainWindow_decrypt_gpg_clicked,
|
||||
mainWindow);
|
||||
|
||||
g_signal_connect(mainWindow->summaryEventBox,
|
||||
"button-press-event",
|
||||
(GCallback) mainWindow_toggleSummaryWrap,
|
||||
mainWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -541,6 +546,7 @@ struct mainWindow *mainWindow_new()
|
||||
mainWindow->checkSearchSummary = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchSummary"));
|
||||
mainWindow->checkSearchTags = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTags"));
|
||||
mainWindow->checkSearchText = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchText"));
|
||||
mainWindow->summaryEventBox = GTK_WIDGET(gtk_builder_get_object(builder, "summaryEventBox"));
|
||||
mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary"));
|
||||
mainWindow->buttonClearSearch = GTK_WIDGET(gtk_builder_get_object(builder, "buttonClearSearch"));
|
||||
mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar"));
|
||||
@ -1038,3 +1044,25 @@ void mainWindow_decrypt_gpg_clicked(GtkWidget *widget, gpointer user_data)
|
||||
g_print("ERROR: This should never happen...\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief mainWindow_toggleSummaryWrap toggles line-wrapping and ellipsize on the summary
|
||||
* @param widget
|
||||
* @param event
|
||||
* @param user_data
|
||||
* @return
|
||||
*/
|
||||
gboolean mainWindow_toggleSummaryWrap(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
{
|
||||
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||
gboolean state;
|
||||
|
||||
state = gtk_label_get_line_wrap(GTK_LABEL(mainWindow->labelSummary));
|
||||
|
||||
gtk_label_set_ellipsize(GTK_LABEL(mainWindow->labelSummary),
|
||||
!state ? PANGO_ELLIPSIZE_NONE : PANGO_ELLIPSIZE_END);
|
||||
|
||||
gtk_label_set_line_wrap(GTK_LABEL(mainWindow->labelSummary), !state);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ struct mainWindow {
|
||||
GtkWidget *checkSearchSummary;
|
||||
GtkWidget *checkSearchTags;
|
||||
GtkWidget *checkSearchText;
|
||||
GtkWidget *summaryEventBox;
|
||||
GtkWidget *labelSummary;
|
||||
GtkWidget *buttonClearSearch;
|
||||
GtkWidget *headerBar;
|
||||
@ -108,5 +109,6 @@ void mainWindow_switch_workspace(struct mainWindow *mainWindow, gchar *path, gbo
|
||||
void mainWindow_decrypt_gpg_clicked(GtkWidget *widget, gpointer user_data);
|
||||
void mainWindow_renderer_set(struct mainWindow *mainWindow, enum renderer_mode state);
|
||||
void mainWindow_settings_show(struct mainWindow *mainWindow);
|
||||
gboolean mainWindow_toggleSummaryWrap(GtkWidget *widget, GdkEvent *event, gpointer user_data);
|
||||
|
||||
#endif /* MAINWINDOW_H */
|
||||
|
Loading…
Reference in New Issue
Block a user