Proxy drop-uris from view to tab.

parent b803f479
......@@ -95,6 +95,15 @@ enum
PROP_AUTO_SAVE_INTERVAL
};
/* Signals */
enum
{
DROP_URIS,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static gboolean gedit_tab_auto_save (GeditTab *tab);
static void
......@@ -281,7 +290,6 @@ gedit_tab_class_init (GeditTabClass *klass)
object_class->dispose = gedit_tab_dispose;
object_class->finalize = gedit_tab_finalize;
object_class->dispose = gedit_tab_dispose;
object_class->get_property = gedit_tab_get_property;
object_class->set_property = gedit_tab_set_property;
......@@ -326,6 +334,17 @@ gedit_tab_class_init (GeditTabClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
signals[DROP_URIS] =
g_signal_new ("drop-uris",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GeditTabClass, drop_uris),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
1,
G_TYPE_STRV);
g_type_class_add_private (object_class, sizeof (GeditTabPrivate));
}
......@@ -1526,6 +1545,14 @@ view_focused_in (GtkWidget *widget,
return FALSE;
}
static void
on_drop_uris (GeditView *view,
gchar **uri_list,
GeditTab *tab)
{
g_signal_emit (G_OBJECT (tab), signals[DROP_URIS], 0, uri_list);
}
static GMountOperation *
tab_mount_operation_factory (GeditDocument *doc,
gpointer userdata)
......@@ -1639,6 +1666,11 @@ gedit_tab_init (GeditTab *tab)
"realize",
G_CALLBACK (view_realized),
tab);
g_signal_connect (tab->priv->view,
"drop-uris",
G_CALLBACK (on_drop_uris),
tab);
}
GtkWidget *
......
......@@ -91,6 +91,9 @@ typedef struct _GeditTabClass GeditTabClass;
struct _GeditTabClass
{
GtkVBoxClass parent_class;
void (* drop_uris) (GeditView *view,
gchar **uri_list);
};
/*
......
......@@ -3097,15 +3097,9 @@ drag_data_received_cb (GtkWidget *widget,
/* Handle drops on the GeditView */
static void
drop_uris_cb (GtkWidget *widget,
gchar **uri_list)
gchar **uri_list,
GeditWindow *window)
{
GeditWindow *window;
window = get_drop_window (widget);
if (window == NULL)
return;
load_uris_from_drop (window, uri_list);
}
......@@ -3521,6 +3515,10 @@ on_tab_added (GeditMultiNotebook *multi,
"notify::state",
G_CALLBACK (sync_state),
window);
g_signal_connect (tab,
"drop_uris",
G_CALLBACK (drop_uris_cb),
window);
g_signal_connect (doc,
"bracket-matched",
......@@ -3564,11 +3562,6 @@ on_tab_added (GeditMultiNotebook *multi,
window);
update_documents_list_menu (window);
g_signal_connect (view,
"drop_uris",
G_CALLBACK (drop_uris_cb),
NULL);
update_window_state (window);
......@@ -3602,6 +3595,9 @@ on_tab_removed (GeditMultiNotebook *multi,
g_signal_handlers_disconnect_by_func (tab,
G_CALLBACK (sync_state),
window);
g_signal_handlers_disconnect_by_func (tab,
G_CALLBACK (drop_uris_cb),
window);
g_signal_handlers_disconnect_by_func (doc,
G_CALLBACK (update_cursor_position_statusbar),
window);
......@@ -3629,9 +3625,6 @@ on_tab_removed (GeditMultiNotebook *multi,
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (editable_changed),
window);
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (drop_uris_cb),
NULL);
if (window->priv->tab_width_id && tab == gedit_multi_notebook_get_active_tab (multi))
{
......
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