[gedit] Add menu when clicking in the interactive search popup icon.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Add menu when clicking in the interactive search popup icon.
- Date: Sun, 25 Jul 2010 19:08:06 +0000 (UTC)
commit 46ff14d93c0b75dcd5deb08a302f24d681be800a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sun Jul 25 21:07:07 2010 +0200
Add menu when clicking in the interactive search popup icon.
gedit/gedit-view.c | 73 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 56 insertions(+), 17 deletions(-)
---
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index cfd6bfa..350e107 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -1289,24 +1289,11 @@ search_enable_popdown (GtkWidget *widget,
}
static void
-search_entry_populate_popup (GtkEntry *entry,
- GtkMenu *menu,
- GeditView *view)
+add_popup_menu_items (GtkWidget *menu,
+ GeditView *view)
{
GtkWidget *menu_item;
- view->priv->disable_popdown = TRUE;
- g_signal_connect (menu, "hide",
- G_CALLBACK (search_enable_popdown), view);
-
- if (view->priv->search_mode == GOTO_LINE)
- return;
-
- /* separator */
- menu_item = gtk_menu_item_new ();
- gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
- gtk_widget_show (menu_item);
-
/* create "Wrap Around" menu item. */
menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Wrap Around"));
g_signal_connect (G_OBJECT (menu_item), "toggled",
@@ -1339,6 +1326,55 @@ search_entry_populate_popup (GtkEntry *entry,
}
static void
+search_entry_populate_popup (GtkEntry *entry,
+ GtkMenu *menu,
+ GeditView *view)
+{
+ GtkWidget *menu_item;
+
+ view->priv->disable_popdown = TRUE;
+ g_signal_connect (menu, "hide",
+ G_CALLBACK (search_enable_popdown), view);
+
+ if (view->priv->search_mode == GOTO_LINE)
+ return;
+
+ /* separator */
+ menu_item = gtk_menu_item_new ();
+ gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+ gtk_widget_show (menu_item);
+
+ add_popup_menu_items (GTK_WIDGET (menu), view);
+}
+
+static void
+search_entry_icon_release (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEventButton *event,
+ GeditView *view)
+{
+ GtkWidget *menu;
+
+ if (view->priv->search_mode == GOTO_LINE ||
+ icon_pos != GTK_ENTRY_ICON_PRIMARY)
+ return;
+
+ menu = gtk_menu_new ();
+ gtk_widget_show (menu);
+
+ view->priv->disable_popdown = TRUE;
+ g_signal_connect (menu, "hide",
+ G_CALLBACK (search_enable_popdown), view);
+
+ add_popup_menu_items (menu, view);
+
+ gtk_menu_popup (GTK_MENU (menu),
+ NULL, NULL,
+ NULL, NULL,
+ event->button, event->time);
+}
+
+static void
search_entry_insert_text (GtkEditable *editable,
const gchar *text,
gint length,
@@ -1579,10 +1615,13 @@ ensure_search_window (GeditView *view)
/* add entry */
view->priv->search_entry = gtk_entry_new ();
gtk_widget_show (view->priv->search_entry);
-
- g_signal_connect (view->priv->search_entry, "populate_popup",
+
+ g_signal_connect (view->priv->search_entry, "populate-popup",
G_CALLBACK (search_entry_populate_popup),
view);
+ g_signal_connect (view->priv->search_entry, "icon-release",
+ G_CALLBACK (search_entry_icon_release),
+ view);
g_signal_connect (view->priv->search_entry, "activate",
G_CALLBACK (search_entry_activate),
view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]