Skip to content

Commit

Permalink
Try to get button label from enclosing toolbar button widget, if present
Browse files Browse the repository at this point in the history
  • Loading branch information
p-e-w committed Nov 27, 2016
1 parent 009cbda commit 6916fc8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Utilities.vala
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ namespace Plotinus.Utilities {
if (button.tooltip_text != null)
return button.tooltip_text;

var tool_button = button.parent as Gtk.ToolButton;
if (tool_button != null) {
// Try to get label from enclosing toolbar button widget
if (tool_button.label != null)
return clean_label(tool_button.label);

if (tool_button.tooltip_text != null)
return tool_button.tooltip_text;
}

var name = button.get_name();
if (name != null) {
// Parse a widely used GtkBuilder naming convention (name_button)
Expand Down

0 comments on commit 6916fc8

Please sign in to comment.