[Xfce4-commits] <parole:master> Added drag and drop support on the video widget.
Ali Abdallah
noreply at xfce.org
Thu Nov 12 16:24:01 CET 2009
Updating branch refs/heads/master
to b387812cd58ecae81a35f99f23a3c0939a177ece (commit)
from 8959cc77dcd715eb1c6b858b968bb948c931e9f3 (commit)
commit b387812cd58ecae81a35f99f23a3c0939a177ece
Author: Ali Abdallah <ali at ali-xfce.org>
Date: Thu Nov 12 16:00:32 2009 +0100
Added drag and drop support on the video widget.
Makefile.am | 5 +++
TODO | 1 -
configure.ac.in | 28 +++++++++++++++++-
data/interfaces/Makefile.am | 2 +-
parole/parole-medialist.c | 68 ++++++++++++++++++++++--------------------
parole/parole-medialist.h | 7 ++++-
parole/parole-player.c | 47 +++++++++++++++++++++++++++++
7 files changed, 122 insertions(+), 36 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index bd3e450..b699693 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,12 @@
+if ENABLE_BROWSER_PLUGIN
+browser_plugin_dir = browser-plugin
+endif
+
SUBDIRS = \
data \
parole \
plugins \
+ browser-plugin \
docs \
po
diff --git a/TODO b/TODO
index c13d24b..7d6ddb4 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,4 @@
=== Media player ===
-* Support some playlist title entity.
* Support scale ratio view.
* Handle missing gstreamer plugins.
* ...
diff --git a/configure.ac.in b/configure.ac.in
index 6b8664f..c987568 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -22,6 +22,7 @@ AC_USE_SYSTEM_EXTENSIONS()
# Basic compiler settings #
# ===================================================== #
AC_PROG_CC()
+AC_PROG_CXX()
AM_PROG_CC_C_O()
AC_PROG_LD()
AC_PROG_INSTALL()
@@ -185,9 +186,23 @@ AM_CONDITIONAL([WINDOW_TITLE_PLUGIN], [test x"$ac_window_title_plugin" = x"yes"]
AC_MSG_RESULT([$ac_window_title_plugin])
#=======================================================#
+# Build browser plugin? #
+#=======================================================#
+AC_ARG_ENABLE([browser-plugin], AC_HELP_STRING([--disable-browser-plugin], [Don't build the browser plugin]),
+ [ac_browser_plugin=$enableval], [ac_browser_plugin=yes])
+AC_MSG_CHECKING([whether to build the browser plugin])
+AM_CONDITIONAL([ENABLE_BROWSER_PLUGIN], [test x"$ac_browser_plugin" = x"yes"])
+AC_MSG_RESULT([$ac_browser_plugin])
+if test x"$ac_browser_plugin" = x"yes"; then
+ XDT_CHECK_PACKAGE([GECKO], [libxul], [])
+ BROWSER_PLUGIN_DIR="${BROWSER_PLUGIN_DIR:-"\${libdir}/mozilla/plugins"}"
+ AC_ARG_VAR([BROWSER_PLUGIN_DIR],[Where to install the browser plugin])
+fi
+
+#=======================================================#
# Check for debugging support #
#=======================================================#
-XDT_FEATURE_DEBUG
+XDT_FEATURE_DEBUG()
#=======================================================#
# Check for Gtk doc #
@@ -210,6 +225,7 @@ plugins/Makefile
plugins/properties/Makefile
plugins/tray/Makefile
plugins/window-title/Makefile
+browser-plugin/Makefile
docs/Makefile
docs/plugin-api/version.xml
docs/plugin-api/Makefile
@@ -227,11 +243,21 @@ echo "
Debug: $enable_debug
Building plugin api docs: ${enable_gtk_doc}
+
Plugins to build:
=================
Stream Properties: ${ac_properties_plugin} (With taglib $TAGLIB_FOUND)
System Tray icon: ${ac_tray_plugin} (With notification $LIBNOTIFY_FOUND)
Window title: ${ac_window_title_plugin}
+
+
+ Browser plugin:
+ ===============
+ Build browser plugin: ${ac_browser_plugin}"
+ if test x${ac_browser_plugin} = x"yes"; then
+echo " installation path: ${BROWSER_PLUGIN_DIR}"
+ fi
+echo "
------------------------------------------------------
Configuration finished, type make to compile"
diff --git a/data/interfaces/Makefile.am b/data/interfaces/Makefile.am
index 433f33e..dbb3922 100644
--- a/data/interfaces/Makefile.am
+++ b/data/interfaces/Makefile.am
@@ -32,7 +32,7 @@ plugins_ui.h: plugins.ui
endif
-DISTCLEANFILES = \
+CLEANFILES = \
$(interfaces_h)
EXTRA_DIST = \
diff --git a/parole/parole-medialist.c b/parole/parole-medialist.c
index b2da840..1faa0f4 100644
--- a/parole/parole-medialist.c
+++ b/parole/parole-medialist.c
@@ -72,6 +72,12 @@ static struct
{ PAROLE_PL_FORMAT_XSPF, ".xspf" }
};
+static GtkTargetEntry target_entry[] =
+{
+ { "STRING", 0, 0 },
+ { "text/uri-list", 0, 1 },
+};
+
static void parole_media_list_dbus_class_init (ParoleMediaListClass *klass);
static void parole_media_list_dbus_init (ParoleMediaList *list);
@@ -159,12 +165,6 @@ enum
LAST_SIGNAL
};
-static GtkTargetEntry target_entry[] =
-{
- { "STRING", 0, 0 },
- { "text/uri-list", 0, 1 },
-};
-
static guint signals [LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (ParoleMediaList, parole_media_list, GTK_TYPE_VBOX)
@@ -297,28 +297,6 @@ parole_media_list_open_location_internal (ParoleMediaList *list)
gtk_widget_show_all (GTK_WIDGET (location));
}
-static gboolean
-parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path, gboolean emit)
-{
- GSList *file_list = NULL;
- GtkFileFilter *filter;
- guint len;
- gboolean ret = FALSE;
-
- filter = parole_get_supported_media_filter ();
- g_object_ref_sink (filter);
-
- parole_get_media_files (filter, path, &file_list);
-
- parole_media_list_files_opened_cb (NULL, file_list, list);
- len = g_slist_length (file_list);
- ret = len == 0 ? FALSE : TRUE;
-
- g_object_unref (filter);
- g_slist_free (file_list);
- return ret;
-}
-
static GSList *
parole_media_list_get_files (ParoleMediaList *list)
{
@@ -362,8 +340,7 @@ void parole_media_list_drag_data_received_cb (GtkWidget *widget,
for ( i = 0; uri_list[i] != NULL; i++)
{
path = g_filename_from_uri (uri_list[i], NULL, NULL);
- if ( parole_media_list_add_by_path (list, path, i == 0 ? TRUE : FALSE) )
- added++;
+ added += parole_media_list_add_by_path (list, path, i == 0 ? TRUE : FALSE);
g_free (path);
}
@@ -1105,6 +1082,28 @@ void parole_media_list_load (ParoleMediaList *list)
}
+gboolean
+parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path, gboolean emit)
+{
+ GSList *file_list = NULL;
+ GtkFileFilter *filter;
+ guint len;
+ gboolean ret = FALSE;
+
+ filter = parole_get_supported_media_filter ();
+ g_object_ref_sink (filter);
+
+ parole_get_media_files (filter, path, &file_list);
+
+ parole_media_list_files_opened_cb (NULL, file_list, list);
+ len = g_slist_length (file_list);
+ ret = len == 0 ? FALSE : TRUE;
+
+ g_object_unref (filter);
+ g_slist_free (file_list);
+ return ret;
+}
+
GtkTreeRowReference *parole_media_list_get_next_row (ParoleMediaList *list,
GtkTreeRowReference *row,
gboolean repeat)
@@ -1274,12 +1273,17 @@ void parole_media_list_open_location (ParoleMediaList *list)
parole_media_list_open_location_internal (list);
}
-void parole_media_list_add_files (ParoleMediaList *list, gchar **filenames)
+gboolean parole_media_list_add_files (ParoleMediaList *list, gchar **filenames)
{
guint i;
+ guint added = 0;
for ( i = 0; filenames && filenames[i] != NULL; i++)
- parole_media_list_add_by_path (list, filenames[i], i == 0 ? TRUE : FALSE);
+ {
+ added += parole_media_list_add_by_path (list, filenames[i], i == 0 ? TRUE : FALSE);
+ }
+
+ return added == i;
}
void parole_media_list_save_list (ParoleMediaList *list)
diff --git a/parole/parole-medialist.h b/parole/parole-medialist.h
index 692144a..ba2ec49 100644
--- a/parole/parole-medialist.h
+++ b/parole/parole-medialist.h
@@ -69,6 +69,11 @@ GtkWidget *parole_media_list_new (void);
void parole_media_list_load (ParoleMediaList *list);
+
+gboolean parole_media_list_add_by_path (ParoleMediaList *list,
+ const gchar *path,
+ gboolean emit);
+
gboolean parole_media_list_is_selected_row (ParoleMediaList *list);
gboolean parole_media_list_is_empty (ParoleMediaList *list);
@@ -98,7 +103,7 @@ void parole_media_list_open (ParoleMediaList *list);
void parole_media_list_open_location (ParoleMediaList *list);
-void parole_media_list_add_files (ParoleMediaList *list,
+gboolean parole_media_list_add_files (ParoleMediaList *list,
gchar **filenames);
void parole_media_list_save_list (ParoleMediaList *list);
diff --git a/parole/parole-player.c b/parole/parole-player.c
index 8ebbd31..322e31d 100644
--- a/parole/parole-player.c
+++ b/parole/parole-player.c
@@ -171,6 +171,13 @@ void parole_show_about (GtkWidget *widget);
gboolean parole_player_key_press (GtkWidget *widget,
GdkEventKey *ev,
ParolePlayer *player);
+
+static GtkTargetEntry target_entry[] =
+{
+ { "STRING", 0, 0 },
+ { "text/uri-list", 0, 1 },
+};
+
/*
* End of GtkBuilder Callbacks
*/
@@ -1492,6 +1499,39 @@ parole_player_configure_event_cb (GtkWidget *widget, GdkEventConfigure *ev, Paro
}
static void
+parole_player_drag_data_received_cb (GtkWidget *widget,
+ GdkDragContext *drag_context,
+ gint x,
+ gint y,
+ GtkSelectionData *data,
+ guint info,
+ guint drag_time,
+ ParolePlayer *player)
+{
+
+ gchar **uri_list;
+ guint added = 0;
+ guint i;
+
+ parole_window_busy_cursor (widget->window);
+
+ uri_list = g_uri_list_extract_uris ((const gchar *)data->data);
+ for ( i = 0; uri_list[i] != NULL; i++)
+ {
+ gchar *path;
+ path = g_filename_from_uri (uri_list[i], NULL, NULL);
+ added += parole_media_list_add_by_path (player->priv->list, path, i == 0 ? TRUE : FALSE);
+
+ g_free (path);
+ }
+
+ g_strfreev (uri_list);
+
+ gdk_window_set_cursor (widget->window, NULL);
+ gtk_drag_finish (drag_context, added == i ? TRUE : FALSE, FALSE, drag_time);
+}
+
+static void
parole_player_init (ParolePlayer *player)
{
GtkBuilder *builder;
@@ -1557,6 +1597,13 @@ parole_player_init (ParolePlayer *player)
g_signal_connect (G_OBJECT (player->priv->gst), "motion-notify-event",
G_CALLBACK (parole_player_gst_widget_motion_notify_event), player);
+ gtk_drag_dest_set (player->priv->gst, GTK_DEST_DEFAULT_ALL,
+ target_entry, G_N_ELEMENTS (target_entry),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
+ g_signal_connect (G_OBJECT (player->priv->gst), "drag-data-received",
+ G_CALLBACK (parole_player_drag_data_received_cb), player);
+
player->priv->window = GTK_WIDGET (gtk_builder_get_object (builder, "main-window"));
player->priv->main_nt = GTK_WIDGET (gtk_builder_get_object (builder, "main-notebook"));
More information about the Xfce4-commits
mailing list