[gedit/wip/use-gsv-search: 19/19] Deprecate gedit_document_get_can_search_again()



commit 7163a8bc899ec47859681925f85b19ab525d9ad4
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jul 13 00:18:37 2013 +0200

    Deprecate gedit_document_get_can_search_again()

 gedit/gedit-document.c |   21 ++++++++++++++++++---
 gedit/gedit-window.c   |   16 ++++++++--------
 2 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 1174938..318acb5 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -348,7 +348,9 @@ gedit_document_get_property (GObject    *object,
                        g_value_set_boxed (value, doc->priv->encoding);
                        break;
                case PROP_CAN_SEARCH_AGAIN:
+                       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
                        g_value_set_boolean (value, gedit_document_get_can_search_again (doc));
+                       G_GNUC_END_IGNORE_DEPRECATIONS;
                        break;
                case PROP_ENABLE_SEARCH_HIGHLIGHTING:
                        g_value_set_boolean (value, gtk_source_buffer_get_highlight_search (GTK_SOURCE_BUFFER 
(doc)));
@@ -521,7 +523,9 @@ gedit_document_class_init (GeditDocumentClass *klass)
        /**
         * GeditDocument:can-search-again:
         *
-        * Deprecated: 3.10: Use the search and replace API in #GtkSourceBuffer.
+        * Deprecated: 3.10: Use the #GtkSourceBuffer:search-text property. When
+        * #GtkSourceBuffer:search-text is non-%NULL,
+        * #GeditDocument:can-search-again is %TRUE.
         */
        g_object_class_install_property (object_class, PROP_CAN_SEARCH_AGAIN,
                                         g_param_spec_boolean ("can-search-again",
@@ -2053,6 +2057,9 @@ gedit_document_goto_line_offset (GeditDocument *doc,
  *
  * Deprecated: 3.10: Use gtk_source_buffer_set_search_text() instead.
  **/
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
 void
 gedit_document_set_search_text (GeditDocument *doc,
                                const gchar   *text,
@@ -2104,6 +2111,8 @@ gedit_document_set_search_text (GeditDocument *doc,
        }
 }
 
+G_GNUC_END_IGNORE_DEPRECATIONS;
+
 /**
  * gedit_document_get_search_text:
  * @doc:
@@ -2123,13 +2132,19 @@ gedit_document_get_search_text (GeditDocument *doc,
        return gtk_source_utils_escape_search_text (doc->priv->search_text);
 }
 
+/**
+ * gedit_document_get_can_search_again:
+ * @doc:
+ *
+ * Deprecated: 3.10: Use gtk_source_buffer_get_search_text() instead. If the
+ * search text is non-%NULL, it means that it can search again.
+ */
 gboolean
 gedit_document_get_can_search_again (GeditDocument *doc)
 {
        g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
 
-       return ((doc->priv->search_text != NULL) &&
-               (*doc->priv->search_text != '\0'));
+       return gtk_source_buffer_get_search_text (GTK_SOURCE_BUFFER (doc)) != NULL;
 }
 
 /**
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 71331e6..538775b 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -795,7 +795,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
                                  state_normal &&
                                  editable);
 
-       b = gedit_document_get_can_search_again (doc);
+       b = gtk_source_buffer_get_search_text (GTK_SOURCE_BUFFER (doc)) != NULL;
        action = gtk_action_group_get_action (window->priv->action_group,
                                              "SearchFindNext");
        gtk_action_set_sensitive (action,
@@ -2869,9 +2869,9 @@ fullscreen_controls_build (GeditWindow *window)
 }
 
 static void
-can_search_again (GeditDocument *doc,
-                 GParamSpec    *pspec,
-                 GeditWindow   *window)
+search_text_notify_cb (GeditDocument *doc,
+                      GParamSpec    *pspec,
+                      GeditWindow   *window)
 {
        gboolean sensitive;
        GtkAction *action;
@@ -2879,7 +2879,7 @@ can_search_again (GeditDocument *doc,
        if (doc != gedit_window_get_active_document (window))
                return;
 
-       sensitive = gedit_document_get_can_search_again (doc);
+       sensitive = gtk_source_buffer_get_search_text (GTK_SOURCE_BUFFER (doc)) != NULL;
 
        action = gtk_action_group_get_action (window->priv->action_group,
                                              "SearchFindNext");
@@ -3095,8 +3095,8 @@ on_tab_added (GeditMultiNotebook *multi,
                          G_CALLBACK (update_cursor_position_statusbar),
                          window);
        g_signal_connect (doc,
-                         "notify::can-search-again",
-                         G_CALLBACK (can_search_again),
+                         "notify::search-text",
+                         G_CALLBACK (search_text_notify_cb),
                          window);
        g_signal_connect (doc,
                          "notify::can-undo",
@@ -3173,7 +3173,7 @@ on_tab_removed (GeditMultiNotebook *multi,
                                              G_CALLBACK (update_cursor_position_statusbar),
                                              window);
        g_signal_handlers_disconnect_by_func (doc,
-                                             G_CALLBACK (can_search_again),
+                                             G_CALLBACK (search_text_notify_cb),
                                              window);
        g_signal_handlers_disconnect_by_func (doc,
                                              G_CALLBACK (can_undo),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]