]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkentry.c
Merge branch 'master' into toolpalette
[~andy/gtk] / gtk / gtkentry.c
index c490f4d780312c7a688f87851073d3f2112823d2..9c885ca54d74bd189e514b2724794ce2545d633a 100644 (file)
@@ -216,7 +216,8 @@ enum {
   PROP_TOOLTIP_TEXT_SECONDARY,
   PROP_TOOLTIP_MARKUP_PRIMARY,
   PROP_TOOLTIP_MARKUP_SECONDARY,
-  PROP_IM_MODULE
+  PROP_IM_MODULE,
+  PROP_EDITING_CANCELED
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
@@ -622,6 +623,10 @@ gtk_entry_class_init (GtkEntryClass *class)
   quark_cursor_hadjustment = g_quark_from_static_string ("gtk-hadjustment");
   quark_capslock_feedback = g_quark_from_static_string ("gtk-entry-capslock-feedback");
 
+  g_object_class_override_property (gobject_class,
+                                    PROP_EDITING_CANCELED,
+                                    "editing-canceled");
+
   g_object_class_install_property (gobject_class,
                                    PROP_BUFFER,
                                    g_param_spec_object ("buffer",
@@ -1231,7 +1236,7 @@ gtk_entry_class_init (GtkEntryClass *class)
                                                                  GTK_PARAM_READABLE));
 
   /**
-   * GtkEntry::progress-border:
+   * GtkEntry:progress-border:
    *
    * The border around the progress bar in the entry.
    *
@@ -1245,7 +1250,7 @@ gtk_entry_class_init (GtkEntryClass *class)
                                                                GTK_PARAM_READABLE));
   
   /**
-   * GtkEntry::invisible-char:
+   * GtkEntry:invisible-char:
    *
    * The invisible character is used when masking entry contents (in
    * \"password mode\")"). When it is not explicitly set with the
@@ -1256,7 +1261,7 @@ gtk_entry_class_init (GtkEntryClass *class)
    * This style property allows the theme to prepend a character
    * to the list of candidates.
    *
-   * Since: 2.22
+   * Since: 2.18
    */
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_unichar ("invisible-char",
@@ -2196,6 +2201,11 @@ gtk_entry_get_property (GObject         *object,
                            gtk_entry_get_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY));
       break;
 
+    case PROP_EDITING_CANCELED:
+      g_value_set_boolean (value,
+                           entry->editing_canceled);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -2656,9 +2666,6 @@ construct_icon_info (GtkWidget            *widget,
   if (GTK_WIDGET_REALIZED (widget))
     realize_icon_info (widget, icon_pos);
 
-  if (GTK_WIDGET_MAPPED (widget))
-    gdk_window_show_unraised (icon_info->window);
-
   return icon_info;
 }
 
@@ -4545,7 +4552,7 @@ gtk_entry_real_delete_text (GtkEditable *editable,
    * buffer_notify_text(), buffer_notify_length()
    */
 
-  gtk_entry_buffer_delete_text (GTK_ENTRY_GET_PRIVATE (editable)->buffer, start_pos, end_pos - start_pos);
+  gtk_entry_buffer_delete_text (get_buffer (GTK_ENTRY (editable)), start_pos, end_pos - start_pos);
 }
 
 /* GtkEntryBuffer signal handlers
@@ -7536,6 +7543,9 @@ gtk_entry_set_icon_from_pixbuf (GtkEntry             *entry,
           g_object_notify (G_OBJECT (entry), "secondary-icon-pixbuf");
           g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type");
         }
+
+      if (GTK_WIDGET_MAPPED (entry))
+          gdk_window_show_unraised (icon_info->window);
     }
 
   gtk_entry_ensure_pixbuf (entry, icon_pos);
@@ -7600,6 +7610,9 @@ gtk_entry_set_icon_from_stock (GtkEntry             *entry,
           g_object_notify (G_OBJECT (entry), "secondary-icon-stock");
           g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type");
         }
+
+      if (GTK_WIDGET_MAPPED (entry))
+          gdk_window_show_unraised (icon_info->window);
     }
 
   gtk_entry_ensure_pixbuf (entry, icon_pos);
@@ -7667,6 +7680,9 @@ gtk_entry_set_icon_from_icon_name (GtkEntry             *entry,
           g_object_notify (G_OBJECT (entry), "secondary-icon-name");
           g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type");
         }
+
+      if (GTK_WIDGET_MAPPED (entry))
+          gdk_window_show_unraised (icon_info->window);
     }
 
   gtk_entry_ensure_pixbuf (entry, icon_pos);
@@ -7731,6 +7747,9 @@ gtk_entry_set_icon_from_gicon (GtkEntry             *entry,
           g_object_notify (G_OBJECT (entry), "secondary-icon-gicon");
           g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type");
         }
+
+      if (GTK_WIDGET_MAPPED (entry))
+          gdk_window_show_unraised (icon_info->window);
     }
 
   gtk_entry_ensure_pixbuf (entry, icon_pos);
@@ -8105,6 +8124,8 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
  * #GtkWidget::drag-begin signal to set a different icon. Note that you 
  * have to use g_signal_connect_after() to ensure that your signal handler
  * gets executed after the default handler.
+ *
+ * Since: 2.16
  */
 void
 gtk_entry_set_icon_drag_source (GtkEntry             *entry,
@@ -8144,6 +8165,8 @@ gtk_entry_set_icon_drag_source (GtkEntry             *entry,
  *
  * Returns: index of the icon which is the source of the current
  *          DND operation, or -1.
+ *
+ * Since: 2.16
  */
 gint
 gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
@@ -9380,6 +9403,9 @@ keypress_completion_out:
            event->keyval == GDK_KP_Enter ||
           event->keyval == GDK_Return)
     {
+      GtkTreeIter iter;
+      GtkTreeModel *model = NULL;
+      GtkTreeSelection *sel;
       gboolean retval = TRUE;
 
       _gtk_entry_reset_im_context (GTK_ENTRY (widget));
@@ -9387,9 +9413,6 @@ keypress_completion_out:
 
       if (completion->priv->current_selected < matches)
         {
-          GtkTreeIter iter;
-          GtkTreeModel *model = NULL;
-          GtkTreeSelection *sel;
           gboolean entry_set;
 
           sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view));
@@ -9421,15 +9444,18 @@ keypress_completion_out:
         }
       else if (completion->priv->current_selected - matches >= 0)
         {
-          GtkTreePath *path;
-
-          _gtk_entry_reset_im_context (GTK_ENTRY (widget));
-
-          path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1);
+          sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view));
+          if (gtk_tree_selection_get_selected (sel, &model, &iter))
+            {
+              GtkTreePath *path;
 
-          g_signal_emit_by_name (completion, "action-activated",
-                                 gtk_tree_path_get_indices (path)[0]);
-          gtk_tree_path_free (path);
+              path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1);
+              g_signal_emit_by_name (completion, "action-activated",
+                                     gtk_tree_path_get_indices (path)[0]);
+              gtk_tree_path_free (path);
+            }
+          else
+            retval = FALSE;
         }
 
       g_free (completion->priv->completion_prefix);