[evolution/wip/webkit-composer: 526/966] Port Find dialog and search functionality



commit 0a611c3e386b4e8cfff8d665f38baa61c8d4b4c4
Author: Dan Vrátil <dvratil redhat com>
Date:   Mon Jul 30 22:05:47 2012 +0200

    Port Find dialog and search functionality
    
    Create EEditorFindDialog class and move all the search functionality
    in there. The dialog is constructed manually, instead of using Glade UI.
    
    Known issues:
     - WebKit does not draw text selection when it does not have focus, which
       means, that we can't see the match until the dialog is closed
     - WebKit seems to eat all the shortcuts, therefor Ctrl+F or Ctrl+G don't
       work atm.

 e-util/Makefile.am            |    2 +
 e-util/e-editor-actions.c     |   81 +++++++---------------
 e-util/e-editor-actions.h     |    2 +
 e-util/e-editor-builder.ui    |  150 ---------------------------------------
 e-util/e-editor-find-dialog.c |  155 +++++++++++++++++++++++++++++++++++++++++
 e-util/e-editor-find-dialog.h |   23 ++++++
 e-util/e-editor-private.h     |   65 +-----------------
 e-util/e-editor-widgets.h     |   18 -----
 e-util/e-util.h               |    1 +
 9 files changed, 210 insertions(+), 287 deletions(-)
---
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 5ec388d..e60bd99 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -180,6 +180,7 @@ evolution_util_include_HEADERS =  \
        e-dialog-utils.h \
        e-dialog-widgets.h \
        e-editor-actions.h \
+       e-editor-find-dialog.h \
        e-editor-selection.h \
        e-editor-widget.h \
        e-editor-widgets.h \
@@ -439,6 +440,7 @@ libevolution_util_la_SOURCES = \
        e-dialog-utils.c \
        e-dialog-widgets.c \
        e-editor-actions.c \
+       e-editor-find-dialog.c \
        e-editor-private.h \
        e-editor-selection.c \
        e-editor-widget.c \
diff --git a/e-util/e-editor-actions.c b/e-util/e-editor-actions.c
index a492953..552f967 100644
--- a/e-util/e-editor-actions.c
+++ b/e-util/e-editor-actions.c
@@ -612,44 +612,6 @@ action_cut_cb (GtkAction *action,
 }
 
 static void
-action_find_cb (GtkAction *action,
-                EEditor *editor)
-{
-       gboolean found;
-
-
-       found = webkit_web_view_search_text (
-               WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)),
-               gtk_entry_get_text (GTK_ENTRY (WIDGET (FIND_ENTRY))),
-               gtk_toggle_button_get_active (
-                       GTK_TOGGLE_BUTTON (WIDGET (FIND_CASE_SENSITIVE))),
-               !gtk_toggle_button_get_active (
-                       GTK_TOGGLE_BUTTON (WIDGET (FIND_BACKWARDS))),
-               gtk_toggle_button_get_active (
-                       GTK_TOGGLE_BUTTON (WIDGET (FIND_WRAP))));
-
-       gtk_action_set_sensitive (ACTION (FIND), found);
-
-       if (!found)
-               gtk_label_set_label (
-                       GTK_LABEL (WIDGET (FIND_RESULT_LABEL)),
-                       N_("No match found"));
-}
-
-static void
-action_find_again_cb (GtkAction *action,
-                      EEditor *editor)
-{
-       /* FIXME WEBKIT
-        * Verify that this actually works and if so, then just change the
-        * callback and remove this function. If not, then we are in trouble...
-        */
-
-       action_find_cb (action, editor);
-}
-
-
-static void
 action_find_and_replace_cb (GtkAction *action,
                             EEditor *editor)
 {
@@ -1277,9 +1239,24 @@ static void
 action_show_find_cb (GtkAction *action,
                      EEditor *editor)
 {
-       gtk_widget_set_sensitive (WIDGET (FIND_BUTTON), TRUE);
+       if (editor->priv->find_dialog == NULL) {
+               editor->priv->find_dialog = e_editor_find_dialog_new (editor);
+               gtk_action_set_sensitive (ACTION (FIND_AGAIN), TRUE);
+       }
+
+       gtk_window_present (GTK_WINDOW (editor->priv->find_dialog));
+}
+
+static void
+action_find_again_cb (GtkAction *action,
+                      EEditor *editor)
+{
+       if (editor->priv->find_dialog == NULL) {
+               return;
+       }
 
-       gtk_window_present (GTK_WINDOW (WIDGET (FIND_WINDOW)));
+       e_editor_find_dialog_find_next (
+               E_EDITOR_FIND_DIALOG (editor->priv->find_dialog));
 }
 
 static void
@@ -1444,20 +1421,6 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_cut_cb) },
 
-       { "find",
-         GTK_STOCK_FIND,
-         NULL,
-         NULL,
-         NULL,
-         G_CALLBACK (action_find_cb) },
-
-       { "find-again",
-         NULL,
-         N_("Find A_gain"),
-         "<Control>g",
-         NULL,
-         G_CALLBACK (action_find_again_cb) },
-
        { "find-and-replace",
          GTK_STOCK_FIND_AND_REPLACE,
          NULL,
@@ -1521,6 +1484,13 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_show_find_cb) },
 
+       { "find-again",
+         NULL,
+         N_("Find A_gain"),
+         "<Control>g",
+         NULL,
+         G_CALLBACK (action_find_again_cb) },
+
        { "show-replace",
          GTK_STOCK_FIND_AND_REPLACE,
          N_("Re_place..."),
@@ -2415,7 +2385,7 @@ editor_actions_init (EEditor *editor)
        /* Fine Tuning */
 
        g_object_set (
-               G_OBJECT (ACTION (FIND)),
+               G_OBJECT (ACTION (SHOW_FIND)),
                "short-label", _("_Find"), NULL);
        g_object_set (
                G_OBJECT (ACTION (FIND_AND_REPLACE)),
@@ -2435,6 +2405,7 @@ editor_actions_init (EEditor *editor)
                "short-label", _("_Table"), NULL);
 
        gtk_action_set_sensitive (ACTION (UNINDENT), FALSE);
+       gtk_action_set_sensitive (ACTION (FIND_AGAIN), FALSE);
 
        editor_widget = e_editor_get_editor_widget (editor);
        g_object_bind_property (
diff --git a/e-util/e-editor-actions.h b/e-util/e-editor-actions.h
index 488451b..9f0616a 100644
--- a/e-util/e-editor-actions.h
+++ b/e-util/e-editor-actions.h
@@ -82,6 +82,8 @@
        E_EDITOR_ACTION ((editor), "edit-menu")
 #define E_EDITOR_ACTION_FIND(editor) \
        E_EDITOR_ACTION ((editor), "find")
+#define E_EDITOR_ACTION_FIND_AGAIN(editor) \
+       E_EDITOR_ACTION ((editor), "find-again")
 #define E_EDITOR_ACTION_FIND_AND_REPLACE(editor) \
        E_EDITOR_ACTION ((editor), "find-and-replace")
 #define E_EDITOR_ACTION_FORMAT_MENU(editor) \
diff --git a/e-util/e-editor-builder.ui b/e-util/e-editor-builder.ui
index f4c6ae2..6552439 100644
--- a/e-util/e-editor-builder.ui
+++ b/e-util/e-editor-builder.ui
@@ -760,156 +760,6 @@
       </object>
     </child>
   </object>
-  <object class="GtkWindow" id="find-window">
-    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-    <property name="title" translatable="yes">Find</property>
-    <property name="resizable">False</property>
-    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="icon_name">gtk-find</property>
-    <signal handler="gtk_widget_hide_on_delete" name="delete_event"/>
-    <signal handler="gtk_widget_grab_focus" name="show" object="find-entry"/>
-    <child>
-      <object class="GtkVBox" id="find-vbox">
-        <property name="visible">True</property>
-        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-        <property name="border_width">12</property>
-        <property name="spacing">12</property>
-        <child>
-          <object class="GtkVBox" id="find-inner-vbox">
-            <property name="visible">True</property>
-            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkEntry" id="find-entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="activates_default">True</property>
-                <signal handler="gtkhtml_editor_find_entry_changed_cb" name="changed" object="find-window"/>
-                <signal handler="gtkhtml_editor_find_entry_activate_cb" name="activate" 
object="find-window"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkHBox" id="find-hbox">
-                <property name="visible">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkCheckButton" id="find-backwards">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">Search _backwards</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                    <signal handler="gtkhtml_editor_find_backwards_toggled_cb" name="toggled" 
object="find-window"/>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkCheckButton" id="find-case-sensitive">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">Case _sensitive</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                    <signal handler="gtkhtml_editor_find_case_sensitive_toggled_cb" name="toggled" 
object="find-window"/>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkCheckButton" id="find-regular-expression">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">_Regular expression</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                    <signal handler="gtkhtml_editor_find_regular_expression_toggled_cb" name="toggled" 
object="find-window"/>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkHBox" id="find-inner-hbox">
-            <property name="visible">True</property>
-            <child>
-              <object class="GtkLabel" id="find-result-label">
-                <property name="visible">True</property>
-                <property name="label"></property>
-                <property name="xalign">0</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkHButtonBox" id="find-button-box">
-                <property name="visible">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="spacing">12</property>
-                <property name="layout_style">GTK_BUTTONBOX_END</property>
-                <child>
-                  <object class="GtkButton" id="find-close-button">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label">gtk-close</property>
-                    <property name="use_stock">True</property>
-                    <signal handler="gtk_widget_hide" name="clicked" object="find-window"/>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkButton" id="find-button">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="has_default">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label">gtk-find</property>
-                    <property name="use_stock">True</property>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="pack_type">GTK_PACK_END</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
   <object class="GtkWindow" id="replace-window">
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
     <property name="title" translatable="yes">Replace</property>
diff --git a/e-util/e-editor-find-dialog.c b/e-util/e-editor-find-dialog.c
index 9aa68b9..a170c88 100644
--- a/e-util/e-editor-find-dialog.c
+++ b/e-util/e-editor-find-dialog.c
@@ -1,8 +1,11 @@
 /*
  * e-editor-find-dialog.h
  *
+<<<<<<< HEAD
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
  *
+=======
+>>>>>>> Port Find dialog and search functionality
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -27,9 +30,16 @@
 #include <glib/gi18n-lib.h>
 #include <gdk/gdkkeysyms.h>
 
+<<<<<<< HEAD
 #define E_EDITOR_FIND_DIALOG_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_EDITOR_FIND_DIALOG, EEditorFindDialogPrivate))
+=======
+G_DEFINE_TYPE (
+       EEditorFindDialog,
+       e_editor_find_dialog,
+       GTK_TYPE_WINDOW);
+>>>>>>> Port Find dialog and search functionality
 
 struct _EEditorFindDialogPrivate {
        GtkWidget *entry;
@@ -38,6 +48,7 @@ struct _EEditorFindDialogPrivate {
        GtkWidget *wrap_search;
 
        GtkWidget *find_button;
+<<<<<<< HEAD
 
        GtkWidget *result_label;
 };
@@ -46,6 +57,19 @@ G_DEFINE_TYPE (
        EEditorFindDialog,
        e_editor_find_dialog,
        E_TYPE_EDITOR_DIALOG);
+=======
+       GtkWidget *cancel_button;
+
+       GtkWidget *result_label;
+
+       EEditor *editor;
+};
+
+enum {
+       PROP_0,
+       PROP_EDITOR
+};
+>>>>>>> Port Find dialog and search functionality
 
 static void
 reset_dialog (EEditorFindDialog *dialog)
@@ -67,6 +91,7 @@ editor_find_dialog_show (GtkWidget *widget)
 }
 
 static void
+<<<<<<< HEAD
 editor_find_dialog_find_cb (EEditorFindDialog *dialog)
 {
        gboolean found;
@@ -75,6 +100,20 @@ editor_find_dialog_find_cb (EEditorFindDialog *dialog)
 
        editor = e_editor_dialog_get_editor (E_EDITOR_DIALOG (dialog));
        editor_widget = e_editor_get_editor_widget (editor);
+=======
+editor_find_dialog_close_cb (EEditorFindDialog *dialog)
+{
+       gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+static void
+editor_find_dialog_find_cb (EEditorFindDialog *dialog)
+{
+       gboolean found;
+       EEditorWidget *editor_widget;
+
+       editor_widget = e_editor_get_editor_widget (dialog->priv->editor);
+>>>>>>> Port Find dialog and search functionality
        found = webkit_web_view_search_text (
                        WEBKIT_WEB_VIEW (editor_widget),
                        gtk_entry_get_text (
@@ -91,6 +130,7 @@ editor_find_dialog_find_cb (EEditorFindDialog *dialog)
 
        gtk_widget_set_sensitive (dialog->priv->find_button, found);
 
+<<<<<<< HEAD
        /* We give focus to WebKit so that the selection is highlited.
         * Without focus selection is not visible (at least with my default
         * color scheme). The focus in fact is not given to WebKit, because
@@ -98,6 +138,8 @@ editor_find_dialog_find_cb (EEditorFindDialog *dialog)
         * the selection :) */
        gtk_widget_grab_focus (GTK_WIDGET (editor_widget));
 
+=======
+>>>>>>> Port Find dialog and search functionality
        if (!found) {
                gtk_label_set_label (
                        GTK_LABEL (dialog->priv->result_label),
@@ -108,8 +150,13 @@ editor_find_dialog_find_cb (EEditorFindDialog *dialog)
 
 static gboolean
 entry_key_release_event (GtkWidget *widget,
+<<<<<<< HEAD
                          GdkEvent *event,
                          gpointer user_data)
+=======
+                        GdkEvent *event,
+                        gpointer user_data)
+>>>>>>> Port Find dialog and search functionality
 {
        GdkEventKey *key = &event->key;
        EEditorFindDialog *dialog = user_data;
@@ -124,6 +171,7 @@ entry_key_release_event (GtkWidget *widget,
 }
 
 static void
+<<<<<<< HEAD
 e_editor_find_dialog_class_init (EEditorFindDialogClass *class)
 {
        GtkWidgetClass *widget_class;
@@ -132,11 +180,67 @@ e_editor_find_dialog_class_init (EEditorFindDialogClass *class)
 
        widget_class = GTK_WIDGET_CLASS (class);
        widget_class->show = editor_find_dialog_show;
+=======
+editor_find_dialog_set_property (GObject *object,
+                                guint property_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+       EEditorFindDialog *dialog = E_EDITOR_FIND_DIALOG (object);
+
+       switch (property_id) {
+               case PROP_EDITOR:
+                       dialog->priv->editor =
+                               g_object_ref (g_value_get_object (value));
+                       return;
+       }
+
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+editor_find_dialog_finalize (GObject *object)
+{
+       EEditorFindDialogPrivate *priv = E_EDITOR_FIND_DIALOG (object)->priv;
+
+       g_clear_object (&priv->editor);
+
+       /* Chain up to parent's finalize */
+       G_OBJECT_CLASS (e_editor_find_dialog_parent_class)->finalize (object);
+}
+
+static void
+e_editor_find_dialog_class_init (EEditorFindDialogClass *klass)
+{
+       GObjectClass *object_class;
+       GtkWidgetClass *widget_class;
+
+       e_editor_find_dialog_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_add_private (klass, sizeof (EEditorFindDialogPrivate));
+
+       widget_class = GTK_WIDGET_CLASS (klass);
+       widget_class->show = editor_find_dialog_show;
+
+       object_class = G_OBJECT_CLASS (klass);
+       object_class->set_property = editor_find_dialog_set_property;
+       object_class->finalize = editor_find_dialog_finalize;
+
+       g_object_class_install_property (
+               object_class,
+               PROP_EDITOR,
+               g_param_spec_object (
+                       "editor",
+                       NULL,
+                       NULL,
+                       E_TYPE_EDITOR,
+                       G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+>>>>>>> Port Find dialog and search functionality
 }
 
 static void
 e_editor_find_dialog_init (EEditorFindDialog *dialog)
 {
+<<<<<<< HEAD
        GtkGrid *main_layout;
        GtkBox *box;
        GtkWidget *widget;
@@ -148,13 +252,32 @@ e_editor_find_dialog_init (EEditorFindDialog *dialog)
        widget = gtk_entry_new ();
        gtk_widget_set_hexpand (widget, TRUE);
        gtk_grid_attach (main_layout, widget, 0, 0, 1, 1);
+=======
+       GtkBox *main_layout, *box;
+       GtkWidget *widget;
+
+       dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
+               dialog, E_TYPE_EDITOR_FIND_DIALOG, EEditorFindDialogPrivate);
+
+       main_layout = GTK_BOX (gtk_vbox_new (FALSE, 5));
+       gtk_container_add (GTK_CONTAINER (dialog), GTK_WIDGET (main_layout));
+       gtk_container_set_border_width (GTK_CONTAINER (dialog), 10);
+
+       widget = gtk_entry_new ();
+       gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
+>>>>>>> Port Find dialog and search functionality
        dialog->priv->entry = widget;
        g_signal_connect (
                widget, "key-release-event",
                G_CALLBACK (entry_key_release_event), dialog);
 
+<<<<<<< HEAD
        box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5));
        gtk_grid_attach (main_layout, GTK_WIDGET (box), 0, 1, 1, 1);
+=======
+       box = GTK_BOX (gtk_hbox_new (FALSE, 5));
+       gtk_box_pack_start (main_layout, GTK_WIDGET (box), TRUE, TRUE, 0);
+>>>>>>> Port Find dialog and search functionality
 
        widget = gtk_check_button_new_with_mnemonic (N_("Search _backwards"));
        gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
@@ -177,8 +300,13 @@ e_editor_find_dialog_init (EEditorFindDialog *dialog)
                widget, "toggled",
                G_CALLBACK (reset_dialog), dialog);
 
+<<<<<<< HEAD
        box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5));
        gtk_grid_attach (main_layout, GTK_WIDGET (box), 0, 2, 1, 1);
+=======
+       box = GTK_BOX (gtk_hbox_new (FALSE, 5));
+       gtk_box_pack_start (main_layout, GTK_WIDGET (box), TRUE, TRUE, 0);
+>>>>>>> Port Find dialog and search functionality
 
        widget = gtk_label_new ("");
        gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
@@ -190,7 +318,17 @@ e_editor_find_dialog_init (EEditorFindDialog *dialog)
        gtk_box_pack_end (box, widget, TRUE, TRUE, 0);
        box = GTK_BOX (widget);
 
+<<<<<<< HEAD
        box = e_editor_dialog_get_button_box (E_EDITOR_DIALOG (dialog));
+=======
+       widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+       gtk_box_pack_start (box, widget, FALSE, FALSE, 5);
+       g_signal_connect_swapped (
+               widget, "clicked",
+               G_CALLBACK (editor_find_dialog_close_cb), dialog);
+       dialog->priv->cancel_button = widget;
+
+>>>>>>> Port Find dialog and search functionality
        widget = gtk_button_new_from_stock (GTK_STOCK_FIND);
        gtk_box_pack_start (box, widget, FALSE, FALSE, 5);
        g_signal_connect_swapped (
@@ -202,14 +340,31 @@ e_editor_find_dialog_init (EEditorFindDialog *dialog)
 }
 
 GtkWidget *
+<<<<<<< HEAD
 e_editor_find_dialog_new (EEditor *editor)
+=======
+e_editor_find_dialog_new(EEditor *editor)
+>>>>>>> Port Find dialog and search functionality
 {
        return GTK_WIDGET (
                g_object_new (
                        E_TYPE_EDITOR_FIND_DIALOG,
+<<<<<<< HEAD
+                       "editor", editor,
+                       "icon-name", GTK_STOCK_FIND,
+                       "title", N_("Find"),
+=======
+                       "destroy-with-parent", TRUE,
+                       "events", GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK,
                        "editor", editor,
                        "icon-name", GTK_STOCK_FIND,
+                       "resizable", FALSE,
                        "title", N_("Find"),
+                       "transient-for", gtk_widget_get_toplevel (GTK_WIDGET (editor)),
+                       "type", GTK_WINDOW_TOPLEVEL,
+                       "type-hint", GDK_WINDOW_TYPE_HINT_POPUP_MENU,
+                       "window-position", GTK_WIN_POS_CENTER_ON_PARENT,
+>>>>>>> Port Find dialog and search functionality
                        NULL));
 }
 
diff --git a/e-util/e-editor-find-dialog.h b/e-util/e-editor-find-dialog.h
index 922f301..60d226e 100644
--- a/e-util/e-editor-find-dialog.h
+++ b/e-util/e-editor-find-dialog.h
@@ -1,8 +1,11 @@
 /*
  * e-editor-find-dialog.h
  *
+<<<<<<< HEAD
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
  *
+=======
+>>>>>>> Port Find dialog and search functionality
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -25,7 +28,12 @@
 #ifndef E_EDITOR_FIND_DIALOG_H
 #define E_EDITOR_FIND_DIALOG_H
 
+<<<<<<< HEAD
 #include <e-util/e-editor-dialog.h>
+=======
+#include <gtk/gtk.h>
+#include <e-util/e-editor.h>
+>>>>>>> Port Find dialog and search functionality
 
 /* Standard GObject macros */
 #define E_TYPE_EDITOR_FIND_DIALOG \
@@ -53,16 +61,31 @@ typedef struct _EEditorFindDialogClass EEditorFindDialogClass;
 typedef struct _EEditorFindDialogPrivate EEditorFindDialogPrivate;
 
 struct _EEditorFindDialog {
+<<<<<<< HEAD
        EEditorDialog parent;
+=======
+       GtkWindow parent;
+
+>>>>>>> Port Find dialog and search functionality
        EEditorFindDialogPrivate *priv;
 };
 
 struct _EEditorFindDialogClass {
+<<<<<<< HEAD
        EEditorDialogClass parent_class;
 };
 
 GType          e_editor_find_dialog_get_type   (void) G_GNUC_CONST;
 GtkWidget *    e_editor_find_dialog_new        (EEditor *editor);
+=======
+       GtkWindowClass parent_class;
+};
+
+GType          e_editor_find_dialog_get_type   (void);
+
+GtkWidget*     e_editor_find_dialog_new        (EEditor *editor);
+
+>>>>>>> Port Find dialog and search functionality
 void           e_editor_find_dialog_find_next  (EEditorFindDialog *dialog);
 
 G_END_DECLS
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index ffd093d..1688dd3 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -1,11 +1,4 @@
-<<<<<<< HEAD
-/*
- * e-editor-private.h
- *
- * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
-=======
 /* e-editor-private.h
->>>>>>> Initial import of GtkhtmlEditor class
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU Lesser General Public
@@ -29,32 +22,15 @@
 #include <e-action-combo-box.h>
 #include <e-color-combo.h>
 #include <e-editor-actions.h>
-<<<<<<< HEAD
-#include <e-editor-widget.h>
-#include <e-editor-find-dialog.h>
-#include <e-editor-replace-dialog.h>
-#include <e-editor-link-dialog.h>
-#include <e-editor-hrule-dialog.h>
-#include <e-editor-table-dialog.h>
-#include <e-editor-page-dialog.h>
-#include <e-editor-image-dialog.h>
-#include <e-editor-text-dialog.h>
-#include <e-editor-paragraph-dialog.h>
-#include <e-editor-cell-dialog.h>
-#include <e-editor-spell-check-dialog.h>
-=======
 #include <e-editor-widgets.h>
 #include <e-editor-widget.h>
->>>>>>> Initial import of GtkhtmlEditor class
+#include <e-editor-find-dialog.h>
 
 #ifdef HAVE_XFREE
 #include <X11/XF86keysym.h>
 #endif
 
-<<<<<<< HEAD
-=======
 
->>>>>>> Initial import of GtkhtmlEditor class
 #define ACTION(name) (E_EDITOR_ACTION_##name (editor))
 #define WIDGET(name) (E_EDITOR_WIDGETS_##name (editor))
 
@@ -69,36 +45,16 @@ struct _EEditorPrivate {
        GtkActionGroup *language_actions;
        GtkActionGroup *spell_check_actions;
        GtkActionGroup *suggestion_actions;
-<<<<<<< HEAD
-=======
        GtkBuilder *builder;
->>>>>>> Initial import of GtkhtmlEditor class
 
        GtkWidget *main_menu;
        GtkWidget *main_toolbar;
        GtkWidget *edit_toolbar;
        GtkWidget *html_toolbar;
-<<<<<<< HEAD
-       GtkWidget *activity_bar;
-       GtkWidget *alert_bar;
        GtkWidget *edit_area;
 
        GtkWidget *find_dialog;
-       GtkWidget *replace_dialog;
-       GtkWidget *link_dialog;
-       GtkWidget *hrule_dialog;
-       GtkWidget *table_dialog;
-       GtkWidget *page_dialog;
-       GtkWidget *image_dialog;
-       GtkWidget *text_dialog;
-       GtkWidget *paragraph_dialog;
-       GtkWidget *cell_dialog;
-       GtkWidget *spell_check_dialog;
-
-=======
-       GtkWidget *edit_area;
 
->>>>>>> Initial import of GtkhtmlEditor class
        GtkWidget *color_combo_box;
        GtkWidget *mode_combo_box;
        GtkWidget *size_combo_box;
@@ -106,29 +62,10 @@ struct _EEditorPrivate {
        GtkWidget *scrolled_window;
 
        EEditorWidget *editor_widget;
-<<<<<<< HEAD
-       EEditorSelection *selection;
-
-       gchar *filename;
-
-       guint spell_suggestions_merge_id;
-
-       WebKitDOMNode *image;
-       WebKitDOMNode *table_cell;
-
-       gint editor_layout_row;
-
-       gboolean busy;
-
-       /* The web view is uneditable while the editor is busy.
-        * This is used to restore the previous editable state. */
-       gboolean saved_editable;
-=======
 
        guint ignore_style_change : 1;
 
        gchar *filename;
->>>>>>> Initial import of GtkhtmlEditor class
 };
 
 void           editor_actions_init             (EEditor *editor);
diff --git a/e-util/e-editor-widgets.h b/e-util/e-editor-widgets.h
index 5b28a7e..fb8bb45 100644
--- a/e-util/e-editor-widgets.h
+++ b/e-util/e-editor-widgets.h
@@ -59,24 +59,6 @@
 #define E_EDITOR_WIDGETS_CELL_PROPERTIES_WRAP_TEXT_CHECK_BUTTON(editor) \
        E_EDITOR_WIDGETS ((editor), "cell-properties-wrap-text-check-button")
 
-/* Find Window */
-#define E_EDITOR_WIDGETS_FIND_BACKWARDS(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-backwards")
-#define E_EDITOR_WIDGETS_FIND_BUTTON(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-button")
-#define E_EDITOR_WIDGETS_FIND_CASE_SENSITIVE(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-case-sensitive")
-#define E_EDITOR_WIDGETS_FIND_WINDOW(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-window")
-#define E_EDITOR_WIDGETS_FIND_ENTRY(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-entry")
-#define E_EDITOR_WIDGETS_FIND_REGULAR_EXPRESSION(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-regular-expression")
-#define E_EDITOR_WIDGETS_FIND_RESULT_LABEL(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-result-label")
-#define E_EDITOR_WIDGETS_FIND_WRAP(editor) \
-       E_EDITOR_WIDGETS ((editor), "find-wrap")
-
 /* Image Properties Window */
 #define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_ALIGNMENT_COMBO_BOX(editor) \
        E_EDITOR_WIDGETS ((editor), "image-properties-alignment-combo-box")
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 37d167d..86da9dc 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -92,6 +92,7 @@
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-dialog-widgets.h>
 #include <e-util/e-editor-actions.h>
+#include <e-util/e-editor-find-dialog.h>
 #include <e-util/e-editor-selection.h>
 #include <e-util/e-editor-widget.h>
 #include <e-util/e-editor-widgets.h>


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