[gedit] Proxy show-popup-menu signal
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Proxy show-popup-menu signal
- Date: Thu, 8 Dec 2011 21:13:47 +0000 (UTC)
commit 36d15fb26ec4bb9ba6d0fe852683f0b4eb71ca5a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Dec 8 22:11:54 2011 +0100
Proxy show-popup-menu signal
gedit/gedit-multi-notebook.c | 22 ++++++++--------------
gedit/gedit-notebook.c | 17 +++++++++++++++--
gedit/gedit-notebook.h | 8 +++++---
3 files changed, 28 insertions(+), 19 deletions(-)
---
diff --git a/gedit/gedit-multi-notebook.c b/gedit/gedit-multi-notebook.c
index bbfe82f..63c0c6c 100644
--- a/gedit/gedit-multi-notebook.c
+++ b/gedit/gedit-multi-notebook.c
@@ -228,18 +228,12 @@ gedit_multi_notebook_class_init (GeditMultiNotebookClass *klass)
G_PARAM_STATIC_STRINGS));
}
-static gboolean
-notebook_button_press_event (GtkNotebook *notebook,
- GdkEventButton *event,
- GeditMultiNotebook *mnb)
+static void
+notebook_show_popup_menu (GtkNotebook *notebook,
+ GdkEvent *event,
+ GeditMultiNotebook *mnb)
{
- if (GDK_BUTTON_PRESS == event->type && 3 == event->button)
- {
- g_signal_emit (G_OBJECT (mnb), signals[SHOW_POPUP_MENU], 0,
- event);
- }
-
- return FALSE;
+ g_signal_emit (G_OBJECT (mnb), signals[SHOW_POPUP_MENU], 0, event);
}
static void
@@ -410,8 +404,8 @@ connect_notebook_signals (GeditMultiNotebook *mnb,
G_CALLBACK (notebook_tab_close_request),
mnb);
g_signal_connect (notebook,
- "button-press-event",
- G_CALLBACK (notebook_button_press_event),
+ "show-popup-menu",
+ G_CALLBACK (notebook_show_popup_menu),
mnb);
}
@@ -433,7 +427,7 @@ disconnect_notebook_signals (GeditMultiNotebook *mnb,
mnb);
g_signal_handlers_disconnect_by_func (notebook, notebook_tab_close_request,
mnb);
- g_signal_handlers_disconnect_by_func (notebook, notebook_button_press_event,
+ g_signal_handlers_disconnect_by_func (notebook, notebook_show_popup_menu,
mnb);
}
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index 62484f7..031627a 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -81,6 +81,7 @@ enum
enum
{
TAB_CLOSE_REQUEST,
+ SHOW_POPUP_MENU,
LAST_SIGNAL
};
@@ -251,7 +252,7 @@ find_tab_num_at_pos (GtkNotebook *notebook,
}
static gboolean
-gedit_notebook_button_press (GtkWidget *widget,
+gedit_notebook_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GtkNotebook *nb = GTK_NOTEBOOK (widget);
@@ -268,9 +269,10 @@ gedit_notebook_button_press (GtkWidget *widget,
/* switch to the page the mouse is over */
gtk_notebook_set_current_page (nb, tab_clicked);
+ g_signal_emit (G_OBJECT (widget), signals[SHOW_POPUP_MENU], 0, event);
+
return TRUE;
}
-
}
return GTK_WIDGET_CLASS (gedit_notebook_parent_class)->button_press_event (widget, event);
@@ -527,6 +529,17 @@ gedit_notebook_class_init (GeditNotebookClass *klass)
1,
GEDIT_TYPE_TAB);
+ signals[SHOW_POPUP_MENU] =
+ g_signal_new ("show-popup-menu",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GeditNotebookClass, show_popup_menu),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE,
+ 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
g_type_class_add_private (object_class, sizeof (GeditNotebookPrivate));
}
diff --git a/gedit/gedit-notebook.h b/gedit/gedit-notebook.h
index 9ea050d..9be2e4f 100644
--- a/gedit/gedit-notebook.h
+++ b/gedit/gedit-notebook.h
@@ -74,7 +74,7 @@ struct _GeditNotebook
GtkNotebook notebook;
/*< private >*/
- GeditNotebookPrivate *priv;
+ GeditNotebookPrivate *priv;
};
/*
@@ -84,11 +84,13 @@ typedef struct _GeditNotebookClass GeditNotebookClass;
struct _GeditNotebookClass
{
- GtkNotebookClass parent_class;
+ GtkNotebookClass parent_class;
/* Signals */
- void (* tab_close_request) (GeditNotebook *notebook,
+ void (* tab_close_request) (GeditNotebook *notebook,
GeditTab *tab);
+ void (* show_popup_menu) (GeditNotebook *notebook,
+ GdkEvent *event);
};
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]