Proxy show-popup-menu signal

parent 7be4e7d9
......@@ -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);
}
......
......@@ -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));
}
......
......@@ -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);
};
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment