After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 724522 - Primary/Secondary icon resizing in GtkEntry
Primary/Secondary icon resizing in GtkEntry
Status: RESOLVED DUPLICATE of bug 710600
Product: gtk+
Classification: Platform
Component: Widget: GtkEntry
3.10.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-02-17 03:44 UTC by Himanshu
Modified: 2017-07-31 19:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Himanshu 2014-02-17 03:44:35 UTC
Hi All , 

In GtkEntry widget , the size of primary/secondary icon is fixed to 16 x 16 pixels irrespective of size of GtkEntry.

gtk_entry_set_icon_from_pixbuf API is used for setting primary/secondary  icon in GtkEntry , but icon is always set of dimension of GTK_ICON_SIZE_MENU ( 16 x 16 ).

Primary/secondary icon should scale to size of any desired input from application .

Please find the proposed patch below :

In GtkEntry source code (gtkentry.c)

I implemented new API "gtk_entry_set_icon_from_pixbuf_at_size" so that user can change the size to any desired dimension .
 
_gtk_icon_helper_set_icon_size (icon_info->icon_helper, icon_size );

Usage of API in application code :

int main( int argc,
char *argv[] )
{
gtk_init (&argc, &argv);
GtkBuilder *builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "icon.glade", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_entry1 = GTK_WIDGET (gtk_builder_get_object (builder, "entry1"));
gtk_entry2 = GTK_WIDGET (gtk_builder_get_object (builder, "entry2"));
pixbuf_entry1 = gdk_pixbuf_new_from_file("primary_icon.png", NULL);
pixbuf_entry2 = gdk_pixbuf_new_from_file("secondary_icon.png", NULL );
pixbuf_entry3 = gdk_pixbuf_new_from_file("primary_icon.png" , NULL);
pixbuf_entry4 = gdk_pixbuf_new_from_file("secondary_icon.png" ,NULL);
 
/* Creating icon size of varied dimension */
GtkIconSize GTK_ICON_SIZE_1_PRIMARY = gtk_icon_size_register ( "gtk-1-primary" , 16 , 16 );
GtkIconSize GTK_ICON_SIZE_1_SECONDARY = gtk_icon_size_register ( "gtk-2-secondary" , 83 , 53 );
GtkIconSize GTK_ICON_SIZE_2_PRIMARY = gtk_icon_size_register ( "gtk-1-primary" , 35 , 35 );
GtkIconSize GTK_ICON_SIZE_2_SECONDARY = gtk_icon_size_register ( "gtk-2-secondary" , 55 , 35 );
 
gtk_entry_set_icon_from_pixbuf_at_size (GTK_ENTRY(gtk_entry1),GTK_ENTRY_ICON_PRIMARY, pixbuf_entry1,GTK_ICON_SIZE_1_PRIMARY );
gtk_entry_set_icon_from_pixbuf_at_size (GTK_ENTRY(gtk_entry1),GTK_ENTRY_ICON_SECONDARY,pixbuf_entry2,GTK_ICON_SIZE_1_SECONDARY );
gtk_entry_set_icon_from_pixbuf_at_size (GTK_ENTRY(gtk_entry2),GTK_ENTRY_ICON_PRIMARY, pixbuf_entry3,GTK_ICON_SIZE_2_PRIMARY );
gtk_entry_set_icon_from_pixbuf_at_size (GTK_ENTRY(gtk_entry2),GTK_ENTRY_ICON_SECONDARY,pixbuf_entry4,GTK_ICON_SIZE_2_SECONDARY );
gtk_widget_show_all (window);
 
gtk_main ();
return 0;
}
Comment 1 Daniel Boles 2017-07-31 19:32:16 UTC
No patch was provided here, and anyway this is a dupe of Bug 710600; please make any updates there instead of starting another bug.

*** This bug has been marked as a duplicate of bug 710600 ***