2009-04-24 Guido Guenther <agx@sigxcpu.org>
authorMarcus Brinkmann <mb@g10code.com>
Fri, 19 Jun 2009 01:25:45 +0000 (01:25 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Fri, 19 Jun 2009 01:25:45 +0000 (01:25 +0000)
* gtk+-2/gtksecentry.c (gtk_secure_entry_class_init): Don't
install "gtk-entry-select-on-focus" settings property since it
clashes with the one from GtkEntry.
(gtk_secure_entry_grab_focus): Create a temporary GtkEntry widget
to read that value instead. Allows to have GtkEntry and
GtkSecureEntry in the same process.

ChangeLog
gtk+-2/gtksecentry.c

index 1fe3539..b2ef010 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-24  Guido Guenther <agx@sigxcpu.org>
+
+       * gtk+-2/gtksecentry.c (gtk_secure_entry_class_init): Don't
+       install "gtk-entry-select-on-focus" settings property since it
+       clashes with the one from GtkEntry.
+       (gtk_secure_entry_grab_focus): Create a temporary GtkEntry widget
+       to read that value instead. Allows to have GtkEntry and
+       GtkSecureEntry in the same process.
+
 2009-06-19  Marcus Brinkmann  <marcus@g10code.de>
 
        Suggested by Simon McVittie:
index 9be6274..2c20c5d 100644 (file)
@@ -665,13 +665,6 @@ gtk_secure_entry_class_init(GtkSecureEntryClass * class)
                                 GDK_CONTROL_MASK, "delete_from_cursor", 2,
                                 G_TYPE_ENUM, GTK_DELETE_WORD_ENDS,
                                 G_TYPE_INT, -1);
-
-    gtk_settings_install_property(g_param_spec_boolean
-                                 ("gtk-entry-select-on-focus",
-                                  _("Select on focus"),
-                                  _
-                                  ("Whether to select the contents of an entry when it is focused"),
-                                  TRUE, G_PARAM_READWRITE));
 }
 
 static void
@@ -1349,14 +1342,18 @@ gtk_secure_entry_focus_out(GtkWidget * widget, GdkEventFocus * event)
 static void
 gtk_secure_entry_grab_focus(GtkWidget * widget)
 {
+    GtkWidget *tmp;
     GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
     gboolean select_on_focus;
 
     GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
     GTK_WIDGET_CLASS(parent_class)->grab_focus(widget);
 
-    g_object_get(gtk_widget_get_settings(widget),
+    /* read current select on focus setting from GtkEntry */
+    tmp = gtk_entry_new ();
+    g_object_get(gtk_widget_get_settings(tmp),
                 "gtk-entry-select-on-focus", &select_on_focus, NULL);
+    gtk_widget_destroy (tmp);
 
     if (select_on_focus && !entry->in_click)
        gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);