[empathy] added a "find" menu item



commit 0c011e92bb7f0d3d14117b0c2f6bf4b73a1a30e7
Author: Thomas Meire <blackskad gmail com>
Date:   Tue Jan 19 21:29:51 2010 +0100

    added a "find" menu item

 libempathy-gtk/empathy-chat.c |   17 ++++++++++++-----
 libempathy-gtk/empathy-chat.h |    1 +
 src/empathy-chat-window.c     |   16 ++++++++++++++++
 src/empathy-chat-window.ui    |    9 +++++++++
 4 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 2189899..5c563c8 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1371,11 +1371,6 @@ chat_input_key_press_event_cb (GtkWidget   *widget,
 		gtk_adjustment_set_value (adj, val);
 		return TRUE;
 	}
-	/* catch ctrl-f to display the search bar */
-	if ((event->state & GDK_CONTROL_MASK) && (event->keyval == GDK_f)) {
-		empathy_search_bar_show (EMPATHY_SEARCH_BAR (priv->search_bar));
-		return TRUE;
-	}
 	if (!(event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) &&
 	    event->keyval == GDK_Tab) {
 		GtkTextBuffer *buffer;
@@ -2891,6 +2886,18 @@ empathy_chat_paste (EmpathyChat *chat)
 }
 
 void
+empathy_chat_find (EmpathyChat *chat)
+{
+	EmpathyChatPriv *priv;
+	
+	g_return_if_fail (EMPATHY_IS_CHAT (chat));
+	
+	priv = GET_PRIV (chat);
+	
+	empathy_search_bar_show (EMPATHY_SEARCH_BAR (priv->search_bar));
+}
+
+void
 empathy_chat_correct_word (EmpathyChat  *chat,
 			  GtkTextIter *start,
 			  GtkTextIter *end,
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 9e09850..7f3ebda 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -77,6 +77,7 @@ void               empathy_chat_scroll_down          (EmpathyChat   *chat);
 void               empathy_chat_cut                  (EmpathyChat   *chat);
 void               empathy_chat_copy                 (EmpathyChat   *chat);
 void               empathy_chat_paste                (EmpathyChat   *chat);
+void               empathy_chat_find                 (EmpathyChat   *chat);
 void               empathy_chat_correct_word         (EmpathyChat   *chat,
 						      GtkTextIter   *start,
 						      GtkTextIter   *end,
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 8cdc58f..801cf57 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -93,6 +93,7 @@ typedef struct {
 	GtkAction   *menu_edit_cut;
 	GtkAction   *menu_edit_copy;
 	GtkAction   *menu_edit_paste;
+	GtkAction   *menu_edit_find;
 
 	GtkAction   *menu_tabs_next;
 	GtkAction   *menu_tabs_prev;
@@ -1002,6 +1003,19 @@ chat_window_paste_activate_cb (GtkAction         *action,
 }
 
 static void
+chat_window_find_activate_cb (GtkAction         *action,
+			      EmpathyChatWindow *window)
+{
+	EmpathyChatWindowPriv *priv;
+
+	g_return_if_fail (EMPATHY_IS_CHAT_WINDOW (window));
+
+	priv = GET_PRIV (window);
+
+	empathy_chat_find (priv->current_chat);
+}
+
+static void
 chat_window_tabs_next_activate_cb (GtkAction         *action,
 				   EmpathyChatWindow *window)
 {
@@ -1805,6 +1819,7 @@ empathy_chat_window_init (EmpathyChatWindow *window)
 				       "menu_edit_cut", &priv->menu_edit_cut,
 				       "menu_edit_copy", &priv->menu_edit_copy,
 				       "menu_edit_paste", &priv->menu_edit_paste,
+				       "menu_edit_find", &priv->menu_edit_find,
 				       "menu_tabs_next", &priv->menu_tabs_next,
 				       "menu_tabs_prev", &priv->menu_tabs_prev,
 				       "menu_tabs_left", &priv->menu_tabs_left,
@@ -1824,6 +1839,7 @@ empathy_chat_window_init (EmpathyChatWindow *window)
 			      "menu_edit_cut", "activate", chat_window_cut_activate_cb,
 			      "menu_edit_copy", "activate", chat_window_copy_activate_cb,
 			      "menu_edit_paste", "activate", chat_window_paste_activate_cb,
+			      "menu_edit_find", "activate", chat_window_find_activate_cb,
 			      "menu_tabs_next", "activate", chat_window_tabs_next_activate_cb,
 			      "menu_tabs_prev", "activate", chat_window_tabs_previous_activate_cb,
 			      "menu_tabs_left", "activate", chat_window_tabs_left_activate_cb,
diff --git a/src/empathy-chat-window.ui b/src/empathy-chat-window.ui
index c2b5625..4ba3502 100644
--- a/src/empathy-chat-window.ui
+++ b/src/empathy-chat-window.ui
@@ -85,6 +85,13 @@
           <accelerator key="V" modifiers="GDK_CONTROL_MASK"/>
         </child>
         <child>
+          <object class="GtkAction" id="menu_edit_find">
+            <property name="stock_id">gtk-find</property>
+            <property name="name">menu_edit_find</property>
+          </object>
+          <accelerator key="F" modifiers="GDK_CONTROL_MASK"/>
+        </child>
+        <child>
           <object class="GtkAction" id="menu_tabs">
             <property name="name">menu_tabs</property>
             <property name="label" translatable="yes">_Tabs</property>
@@ -160,6 +167,8 @@
           <menuitem action="menu_edit_cut"/>
           <menuitem action="menu_edit_copy"/>
           <menuitem action="menu_edit_paste"/>
+          <separator/>
+          <menuitem action="menu_edit_find"/>
         </menu>
         <menu action="menu_tabs">
           <menuitem action="menu_tabs_prev"/>



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