[gedit] Proxy drop-uris from view to tab.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Proxy drop-uris from view to tab.
- Date: Mon, 5 Jul 2010 14:30:21 +0000 (UTC)
commit 4abfc89497b1910c04f0f04077d6eb05cd9f5b50
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Jul 5 16:24:13 2010 +0200
Proxy drop-uris from view to tab.
gedit/gedit-tab.c | 34 +++++++++++++++++++++++++++++++++-
gedit/gedit-tab.h | 3 +++
gedit/gedit-window.c | 25 +++++++++----------------
3 files changed, 45 insertions(+), 17 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 076e4d7..6186d43 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -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 *
diff --git a/gedit/gedit-tab.h b/gedit/gedit-tab.h
index 7a25b9d..1b45989 100644
--- a/gedit/gedit-tab.h
+++ b/gedit/gedit-tab.h
@@ -91,6 +91,9 @@ typedef struct _GeditTabClass GeditTabClass;
struct _GeditTabClass
{
GtkVBoxClass parent_class;
+
+ void (* drop_uris) (GeditView *view,
+ gchar **uri_list);
};
/*
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index d9fecf0..be08578 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -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))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]