mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: in GimpNumberPairEntry, add clear icon
Since the entry behaves differently based on whether the user provided an explicit input or not, it makes sense to have a button for clearing the entry.
This commit is contained in:
parent
45bfa168bf
commit
cd8ea6b3ca
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpicons.h"
|
||||
#include "gimpnumberpairentry.h"
|
||||
|
||||
|
||||
|
@ -139,6 +140,7 @@ static void gimp_number_pair_entry_get_property (GObject
|
|||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_number_pair_entry_changed (GimpNumberPairEntry *entry);
|
||||
static void gimp_number_pair_entry_icon_press (GimpNumberPairEntry *entry);
|
||||
static gboolean gimp_number_pair_entry_events (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
|
||||
|
@ -326,6 +328,9 @@ gimp_number_pair_entry_init (GimpNumberPairEntry *entry)
|
|||
g_signal_connect (entry, "changed",
|
||||
G_CALLBACK (gimp_number_pair_entry_changed),
|
||||
NULL);
|
||||
g_signal_connect (entry, "icon-press",
|
||||
G_CALLBACK (gimp_number_pair_entry_icon_press),
|
||||
NULL);
|
||||
g_signal_connect (entry, "focus-out-event",
|
||||
G_CALLBACK (gimp_number_pair_entry_events),
|
||||
NULL);
|
||||
|
@ -334,6 +339,10 @@ gimp_number_pair_entry_init (GimpNumberPairEntry *entry)
|
|||
NULL);
|
||||
|
||||
gtk_widget_set_direction (GTK_WIDGET (entry), GTK_TEXT_DIR_LTR);
|
||||
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
GIMP_ICON_EDIT_CLEAR);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -773,6 +782,10 @@ gimp_number_pair_entry_modify_font (GimpNumberPairEntry *entry,
|
|||
|
||||
gtk_widget_modify_style (GTK_WIDGET (entry), rc_style);
|
||||
|
||||
gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
! italic);
|
||||
|
||||
priv->font_italic = italic;
|
||||
}
|
||||
|
||||
|
@ -839,6 +852,14 @@ gimp_number_pair_entry_changed (GimpNumberPairEntry *entry)
|
|||
gimp_number_pair_entry_modify_font (entry, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_number_pair_entry_icon_press (GimpNumberPairEntry *entry)
|
||||
{
|
||||
gimp_number_pair_entry_set_user_override (entry, FALSE);
|
||||
|
||||
gtk_editable_set_position (GTK_EDITABLE (entry), -1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_number_pair_entry_events (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
|
|
Loading…
Reference in New Issue