From 03062ad358ccd03a1597d07860ae3020ed45e05d Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Wed, 25 Jul 2012 20:34:45 +0300 Subject: [PATCH] Hildon UI: remove dead technology That plugin was written for Maemo 4. It barely worked with Maemo 5. Maemo 6 did not have Hildon. Hildon is unmaintained and unused. --- Makefile.am | 5 +- NEWS | 1 + configure.ac | 27 -- modules/LIST | 1 - modules/gui/Modules.am | 5 +- modules/gui/hildon/Modules.am | 9 - modules/gui/hildon/maemo.c | 371 --------------- modules/gui/hildon/maemo.h | 66 --- modules/gui/hildon/maemo_callbacks.c | 363 -------------- modules/gui/hildon/maemo_callbacks.h | 48 -- modules/gui/hildon/maemo_input.c | 223 --------- modules/gui/hildon/maemo_input.h | 46 -- modules/gui/hildon/maemo_interface.c | 155 ------ modules/gui/hildon/maemo_interface.h | 29 -- modules/gui/hildon/maemo_menus.c | 682 --------------------------- po/POTFILES.in | 1 - share/Makefile.am | 18 - share/maemo/next.png | Bin 101 -> 0 bytes share/maemo/pause.png | Bin 82 -> 0 bytes share/maemo/play.png | Bin 102 -> 0 bytes share/maemo/playlist.png | Bin 85 -> 0 bytes share/maemo/previous.png | Bin 104 -> 0 bytes share/maemo/stop.png | Bin 80 -> 0 bytes share/maemo/vlc_intf.rc | 42 -- share/maemo/vlc_left_tab_active.png | Bin 222 -> 0 bytes share/maemo/vlc_left_tab_passive.png | Bin 201 -> 0 bytes 26 files changed, 3 insertions(+), 2089 deletions(-) delete mode 100644 modules/gui/hildon/Modules.am delete mode 100644 modules/gui/hildon/maemo.c delete mode 100644 modules/gui/hildon/maemo.h delete mode 100644 modules/gui/hildon/maemo_callbacks.c delete mode 100644 modules/gui/hildon/maemo_callbacks.h delete mode 100644 modules/gui/hildon/maemo_input.c delete mode 100644 modules/gui/hildon/maemo_input.h delete mode 100644 modules/gui/hildon/maemo_interface.c delete mode 100644 modules/gui/hildon/maemo_interface.h delete mode 100644 modules/gui/hildon/maemo_menus.c delete mode 100644 share/maemo/next.png delete mode 100644 share/maemo/pause.png delete mode 100644 share/maemo/play.png delete mode 100644 share/maemo/playlist.png delete mode 100644 share/maemo/previous.png delete mode 100644 share/maemo/stop.png delete mode 100644 share/maemo/vlc_intf.rc delete mode 100644 share/maemo/vlc_left_tab_active.png delete mode 100644 share/maemo/vlc_left_tab_passive.png diff --git a/Makefile.am b/Makefile.am index 7187a485b7..bc088f78b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -568,7 +568,7 @@ doc: # Building aliases ############################################################################### -ALL_ALIASES = cvlc rvlc svlc qvlc nvlc mvlc +ALL_ALIASES = cvlc rvlc svlc qvlc nvlc bin_SCRIPTS = $(ALIASES) CLEANFILES += $(ALIASES) $(noinst_SCRIPTS) EXTRA_SCRIPTS = $(ALL_ALIASES) @@ -592,9 +592,6 @@ qvlc: make-alias Makefile nvlc: make-alias Makefile $(AM_V_GEN)$(MKALIAS) ncurses -mvlc: make-alias Makefile - $(AM_V_GEN)$(MKALIAS) maemo - if BUILD_VLC noinst_SCRIPTS = vlc$(EXEEXT) endif diff --git a/NEWS b/NEWS index 0e4d464897..cdde7cf400 100644 --- a/NEWS +++ b/NEWS @@ -66,6 +66,7 @@ Removed modules: * Linux Framebuffer On Screen Display interface (fbosd) * RTMP access: use libavformat avio instead * RTMP access_output: use libavformat avio instead + * Hildon GUI Changes between 2.0.2 and 2.0.3: diff --git a/configure.ac b/configure.ac index 3cf2412b47..29fed583f7 100644 --- a/configure.ac +++ b/configure.ac @@ -3551,32 +3551,6 @@ dnl EXTEND_HELP_STRING([Interface plugins:]) -dnl -dnl Hildon UI -dnl -AC_ARG_ENABLE(hildon, - [ --enable-hildon Hildon touchscreen UI (default disabled)]) -AS_IF([test "${enable_hildon}" = "yes"], [ - PKG_CHECK_MODULES(HILDON, [hildon-1], [ - PKG_CHECK_MODULES(HILDON_FM, hildon-fm-2, [ - VLC_ADD_CFLAGS([hildon],[${HILDON_FM_CFLAGS} -DHAVE_HILDON_FM]) - VLC_ADD_LIBS([hildon],[${HILDON_FM_LIBS}]) - ], [ - AC_MSG_WARN([${HILDON_FM_PKG_ERRORS}.]) - ]) - VLC_ADD_CFLAGS([hildon],[${HILDON_CFLAGS} ${X_CFLAGS}]) - VLC_ADD_LIBS([hildon],[${HILDON_LIBS} ${X_LIBS} ${X_PRE_LIBS} -lX11]) - VLC_ADD_PLUGIN([hildon]) - ALIASES="${ALIASES} mvlc" - ], [ - AS_IF([test "${enable_hildon}" = "yes"],[ - AC_MSG_ERROR([${HILDON_PKG_ERRORS}.]) - ]) - enable_hildon="no" - ]) -]) -AM_CONDITIONAL(BUILD_HILDON, [test "${enable_hildon}" = "yes"]) - dnl dnl QT dnl @@ -4190,7 +4164,6 @@ AC_CONFIG_FILES([ modules/demux/playlist/Makefile modules/gui/Makefile modules/gui/macosx/Makefile - modules/gui/hildon/Makefile modules/gui/minimal_macosx/Makefile modules/gui/macosx_dialog_provider/Makefile modules/gui/qt4/Makefile diff --git a/modules/LIST b/modules/LIST index e6af94eb77..3f2cce3386 100644 --- a/modules/LIST +++ b/modules/LIST @@ -143,7 +143,6 @@ $Id$ * growl: announce currently playing stream to growl * h264: H264 decoder * headphone_channel_mixer: headphone channel mixer with virtual spatialization effect - * hildon: Maemo interface based on Hildon * hotkeys: hotkeys control module * hqdn3d: High Quality denoising filter * htcpcp: HTCPCP access module diff --git a/modules/gui/Modules.am b/modules/gui/Modules.am index 7189cfca08..3f9ec39618 100644 --- a/modules/gui/Modules.am +++ b/modules/gui/Modules.am @@ -1,12 +1,9 @@ -DIST_SUBDIRS = macosx hildon minimal_macosx qt4 skins2 macosx_dialog_provider +DIST_SUBDIRS = macosx minimal_macosx qt4 skins2 macosx_dialog_provider SUBDIRS = if HAVE_DARWIN SUBDIRS += macosx macosx_dialog_provider endif -if BUILD_HILDON -SUBDIRS += hildon -endif if ENABLE_QT4 SUBDIRS += qt4 endif diff --git a/modules/gui/hildon/Modules.am b/modules/gui/hildon/Modules.am deleted file mode 100644 index 572f67cbba..0000000000 --- a/modules/gui/hildon/Modules.am +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES_hildon = maemo.c \ - maemo.h \ - maemo_callbacks.c \ - maemo_callbacks.h \ - maemo_input.c \ - maemo_input.h \ - maemo_interface.c \ - maemo_interface.h \ - maemo_menus.c diff --git a/modules/gui/hildon/maemo.c b/modules/gui/hildon/maemo.c deleted file mode 100644 index 7f2619db49..0000000000 --- a/modules/gui/hildon/maemo.c +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** - * maemo.c : Maemo plugin for VLC - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * Gildas Bazin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "maemo.h" -#include "maemo_callbacks.h" -#include "maemo_input.h" -#include "maemo_interface.h" - -/***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int Open ( vlc_object_t * ); -static void Close ( vlc_object_t * ); -static void *Thread ( void * ); -static int OpenWindow ( vout_window_t *, const vout_window_cfg_t * ); -static void CloseWindow ( vout_window_t * ); -static int ControlWindow ( vout_window_t *, int, va_list ); -static gboolean interface_ready ( gpointer ); - -/***************************************************************************** -* Module descriptor -*****************************************************************************/ -vlc_module_begin(); - set_shortname( "Maemo" ); - set_description( N_("Maemo hildon interface") ); - set_category( CAT_INTERFACE ); - set_subcategory( SUBCAT_INTERFACE_MAIN ); - set_capability( "interface", 70 ); - set_callbacks( Open, Close ); - add_shortcut( "maemo" ); - - add_submodule(); - set_capability( "vout window xid", 50 ); - set_callbacks( OpenWindow, CloseWindow ); -vlc_module_end(); - -/***************************************************************************** - * Module callbacks - *****************************************************************************/ -static int Open( vlc_object_t *p_this ) -{ - intf_thread_t *p_intf = (intf_thread_t *)p_this; - intf_sys_t *p_sys; - vlc_value_t val; - - if( !vlc_xlib_init( p_this ) ) - return VLC_EGENERIC; - - /* Allocate instance and initialize some members */ - p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) ); - if( p_intf->p_sys == NULL ) - return VLC_ENOMEM; - - p_sys->p_playlist = pl_Get( p_intf ); - p_sys->p_input = NULL; - - p_sys->p_main_window = NULL; - p_sys->p_video_window = NULL; - p_sys->p_control_window = NULL; - p_sys->b_fullscreen = false; - p_sys->i_event = 0; - - vlc_spin_init( &p_sys->event_lock ); - - /* Create separate thread for main interface */ - vlc_sem_init (&p_sys->ready, 0); - if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) ) - { - free (p_sys); - return VLC_ENOMEM; - } - - /* Wait for interface thread to be fully initialised */ - vlc_sem_wait (&p_sys->ready); - vlc_sem_destroy (&p_sys->ready); - - var_Create (p_this->p_libvlc, "hildon-iface", VLC_VAR_ADDRESS); - val.p_address = p_this; - var_Set (p_this->p_libvlc, "hildon-iface", val); - - return VLC_SUCCESS; -} - -static void Close( vlc_object_t *p_this ) -{ - intf_thread_t *p_intf = (intf_thread_t *)p_this; - - var_Destroy (p_this->p_libvlc, "hildon-iface"); - - gtk_main_quit(); - vlc_join (p_intf->p_sys->thread, NULL); - vlc_spin_destroy( &p_intf->p_sys->event_lock ); - free( p_intf->p_sys ); -} - -static gint quit_event( GtkWidget *widget, GdkEvent *event, gpointer data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)data; - (void)widget; (void)event; - libvlc_Quit( p_intf->p_libvlc ); - return TRUE; -} - -/***************************************************************************** -* Initialize and launch the interface -*****************************************************************************/ -static void *Thread( void *obj ) -{ - intf_thread_t *p_intf = (intf_thread_t *)obj; - const char *p_args[] = { "vlc" }; - int i_args = sizeof(p_args)/sizeof(char *); - char **pp_args = (char **)p_args; - - HildonProgram *program; - HildonWindow *window; - GtkWidget *main_vbox, *bottom_hbox; - GtkWidget *video, *seekbar; - GtkWidget *play_button, *prev_button, *next_button; - GtkWidget *stop_button, *playlist_button; - - gtk_init( &i_args, &pp_args ); - - program = HILDON_PROGRAM( hildon_program_get_instance() ); - g_set_application_name( "VLC Media Player" ); - - window = HILDON_WINDOW( hildon_window_new() ); - hildon_program_add_window( program, window ); - gtk_object_set_data( GTK_OBJECT( window ), "p_intf", p_intf ); - p_intf->p_sys->p_main_window = window; - - g_signal_connect( GTK_WIDGET(window), "key-press-event", - G_CALLBACK( key_cb ), p_intf ); - g_signal_connect (GTK_WIDGET(window), "delete_event", - GTK_SIGNAL_FUNC( quit_event), p_intf ); - - // A little theming - char *psz_rc_file = NULL; - char *psz_data = config_GetDataDir(); - if( asprintf( &psz_rc_file, "%s/maemo/vlc_intf.rc", psz_data ) != -1 ) - { - gtk_rc_parse( psz_rc_file ); - free( psz_rc_file ); - } - free( psz_data ); - - // We create the main vertical box - main_vbox = gtk_vbox_new( FALSE, 0 ); - gtk_container_add( GTK_CONTAINER( window ), main_vbox ); - - // Menubar - GtkWidget *main_menu = create_menu( p_intf ); -#ifdef HAVE_MAEMO - hildon_window_set_menu( HILDON_WINDOW( p_intf->p_sys->p_main_window ), - GTK_MENU( main_menu ) ); -#else - GtkWidget *menu_bar = gtk_menu_bar_new (); - GtkWidget *item = gtk_menu_item_new_with_label ("Menu"); - gtk_menu_bar_append(menu_bar, item); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), main_menu); - gtk_widget_show_all (menu_bar); - gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, FALSE, 0); -#endif - - // We put first the embedded video - video = gtk_event_box_new(); - GdkColor black = {0,0,0,0}; - gtk_widget_modify_bg(video, GTK_STATE_NORMAL, &black); - p_intf->p_sys->p_video_window = video; - gtk_box_pack_start( GTK_BOX( main_vbox ), video, TRUE, TRUE, 0 ); - - create_playlist( p_intf ); - gtk_box_pack_start( GTK_BOX( main_vbox ), p_intf->p_sys->p_playlist_window, TRUE, TRUE, 0 ); - - // We put the horizontal box which contains all the buttons - p_intf->p_sys->p_control_window = bottom_hbox = gtk_hbox_new( FALSE, 0 ); - - // We create the buttons - play_button = gtk_button_new(); - gtk_button_set_image( GTK_BUTTON( play_button ), - gtk_image_new_from_stock( "vlc-play", GTK_ICON_SIZE_BUTTON ) ); - p_intf->p_sys->p_play_button = play_button; - stop_button = gtk_button_new(); - gtk_button_set_image( GTK_BUTTON( stop_button ), - gtk_image_new_from_stock( "vlc-stop", GTK_ICON_SIZE_BUTTON ) ); - prev_button = gtk_button_new(); - gtk_button_set_image( GTK_BUTTON( prev_button ), - gtk_image_new_from_stock( "vlc-previous", GTK_ICON_SIZE_BUTTON ) ); - next_button = gtk_button_new(); - gtk_button_set_image( GTK_BUTTON( next_button ), - gtk_image_new_from_stock( "vlc-next", GTK_ICON_SIZE_BUTTON ) ); - playlist_button = gtk_button_new(); - gtk_button_set_image( GTK_BUTTON( playlist_button ), - gtk_image_new_from_stock( "vlc-playlist", GTK_ICON_SIZE_BUTTON ) ); - seekbar = hildon_seekbar_new(); - p_intf->p_sys->p_seekbar = HILDON_SEEKBAR( seekbar ); - - // We add them to the hbox - gtk_box_pack_start( GTK_BOX( bottom_hbox ), play_button, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( bottom_hbox ), stop_button, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( bottom_hbox ), prev_button, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( bottom_hbox ), next_button, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( bottom_hbox ), playlist_button, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( bottom_hbox ), seekbar , TRUE , TRUE , 5 ); - // We add the hbox to the main vbox - gtk_box_pack_start( GTK_BOX( main_vbox ), bottom_hbox, FALSE, FALSE, 0 ); - - g_signal_connect( play_button, "clicked", G_CALLBACK( play_cb ), NULL ); - g_signal_connect( stop_button, "clicked", G_CALLBACK( stop_cb ), NULL ); - g_signal_connect( prev_button, "clicked", G_CALLBACK( prev_cb ), NULL ); - g_signal_connect( next_button, "clicked", G_CALLBACK( next_cb ), NULL ); - g_signal_connect( playlist_button, "clicked", G_CALLBACK( playlist_cb ), NULL ); - g_signal_connect( seekbar, "change-value", - G_CALLBACK( seekbar_changed_cb ), NULL ); - - gtk_widget_show_all( GTK_WIDGET( window ) ); - gtk_widget_hide_all( p_intf->p_sys->p_playlist_window ); - -#if 1 - /* HACK: Only one X11 client can subscribe to mouse button press events. - * VLC currently handles those in the video display. - * Force GTK to unsubscribe from mouse press and release events. */ - Display *dpy = GDK_WINDOW_XDISPLAY( gtk_widget_get_window(p_intf->p_sys->p_video_window) ); - Window w = GDK_WINDOW_XID( gtk_widget_get_window(p_intf->p_sys->p_video_window) ); - XWindowAttributes attr; - - XGetWindowAttributes( dpy, w, &attr ); - attr.your_event_mask &= ~(ButtonPressMask|ButtonReleaseMask); - XSelectInput( dpy, w, attr.your_event_mask ); -#endif - - // The embedded video is only ready after gtk_main and windows are shown - g_idle_add( interface_ready, p_intf ); - - gtk_main(); - - delete_input( p_intf ); - delete_playlist( p_intf ); - - gtk_object_destroy( GTK_OBJECT( main_menu ) ); - gtk_object_destroy( GTK_OBJECT( window ) ); - - return NULL; -} - -/** -* Video output window provider -*/ -static int OpenWindow (vout_window_t *p_wnd, const vout_window_cfg_t *cfg) -{ - intf_thread_t *p_intf; - vlc_value_t val; - - if (cfg->is_standalone) - return VLC_EGENERIC; - - if( var_Get( p_obj->p_libvlc, "hildon-iface", &val ) ) - val.p_address = NULL; - - p_intf = (intf_thread_t *)val.p_address; - if( !p_intf ) - { /* If another interface is used, this plugin cannot work */ - msg_Dbg( p_obj, "Hildon interface not found" ); - return VLC_EGENERIC; - } - - p_wnd->handle.xid = p_intf->p_sys->xid; - - if (!p_wnd->handle.xid) - return VLC_EGENERIC; - - p_wnd->control = ControlWindow; - p_wnd->sys = (vout_window_sys_t*)p_intf; - - return VLC_SUCCESS; -} - -static int ControlWindow (vout_window_t *p_wnd, int query, va_list args) -{ - intf_thread_t *p_intf = (intf_thread_t *)p_wnd->sys; - - switch( query ) - { - case VOUT_WINDOW_SET_SIZE: - { - int i_width = (int)va_arg( args, int ); - int i_height = (int)va_arg( args, int ); - - int i_current_w, i_current_h; - gdk_drawable_get_size( GDK_DRAWABLE( p_intf->p_sys->p_video_window ), - &i_current_w, &i_current_h ); - if( i_width != i_current_w || i_height != i_current_h ) - return VLC_EGENERIC; - return VLC_SUCCESS; - } - case VOUT_WINDOW_SET_FULLSCREEN: - { - bool b_fs = va_arg( args, int ); - p_intf->p_sys->b_fullscreen = b_fs; - g_idle_add( fullscreen_cb, p_intf ); - return VLC_SUCCESS; - } - default: - return VLC_EGENERIC; - } -} - -static void CloseWindow (vout_window_t *p_wnd) -{ - intf_thread_t *p_intf = (intf_thread_t *)p_wnd->sys; - - if( p_intf->p_sys->b_fullscreen ) - { - p_intf->p_sys->b_fullscreen = false; - g_idle_add( fullscreen_cb, p_intf ); - } -} - -static gboolean interface_ready( gpointer data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)data; - - p_intf->p_sys->xid = - GDK_WINDOW_XID( gtk_widget_get_window(p_intf->p_sys->p_video_window) ); - - // Refresh playlist - post_event( p_intf, EVENT_PLAYLIST_CURRENT ); - - // Everything is initialised - vlc_sem_post (&p_intf->p_sys->ready); - - // We want it to be executed only one time - return FALSE; -} diff --git a/modules/gui/hildon/maemo.h b/modules/gui/hildon/maemo.h deleted file mode 100644 index d30e499c71..0000000000 --- a/modules/gui/hildon/maemo.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * maemo.h: private Maemo Interface Description - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include - -struct intf_sys_t -{ - vlc_thread_t thread; - - playlist_t *p_playlist; - input_thread_t *p_input; - vlc_sem_t ready; - - HildonWindow *p_main_window; - HildonSeekbar *p_seekbar; - GtkWidget *p_play_button; - - GtkListStore *p_playlist_store; - GtkWidget *p_playlist_window; - - int i_event; - vlc_spinlock_t event_lock; - - GtkWidget *p_video_window; - uint32_t xid; /* X11 windows ID */ - bool b_fullscreen; - - GtkWidget *p_control_window; - - GtkMenuItem *menu_input; - GtkMenuItem *menu_audio; - GtkMenuItem *menu_video; -}; - -GtkWidget *create_menu( intf_thread_t *p_intf ); diff --git a/modules/gui/hildon/maemo_callbacks.c b/modules/gui/hildon/maemo_callbacks.c deleted file mode 100644 index a26fed323c..0000000000 --- a/modules/gui/hildon/maemo_callbacks.c +++ /dev/null @@ -1,363 +0,0 @@ -/***************************************************************************** - * maemo_callbacks.c : Callbacks for the maemo plugin. - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * Gildas Bazin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#include - -#include "maemo.h" -#include "maemo_callbacks.h" - -#include -#include - -#ifdef HAVE_HILDON_FM -# include -#endif - -/* - * Function used to retrieve an intf_thread_t object from a GtkWidget - */ -static intf_thread_t *get_intf_from_widget( GtkWidget *widget ) -{ - if( GTK_IS_MENU_ITEM( widget ) ) - { - /* Look for a GTK_MENU */ - while( widget->parent && !GTK_IS_MENU( widget ) ) - { - widget = widget->parent; - } - - widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) ); - } - widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) ); - return (intf_thread_t *)gtk_object_get_data( GTK_OBJECT( widget ), - "p_intf" ); -} - -void play_cb( GtkButton *button, gpointer user_data ) -{ - (void)user_data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); - - // If there is no input, we ask the playlist to play - if( p_intf->p_sys->p_input == NULL ) - { - playlist_Play( p_intf->p_sys->p_playlist ); - return; - } - - // If there is an input, we toggle its state - vlc_value_t state; - var_Get( p_intf->p_sys->p_input, "state", &state ); - state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S; - var_Set( p_intf->p_sys->p_input, "state", state ); -} - -void stop_cb( GtkButton *button, gpointer user_data ) -{ - (void)user_data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); - playlist_Stop( p_intf->p_sys->p_playlist ); -} - -void prev_cb( GtkButton *button, gpointer user_data ) -{ - (void)user_data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); - playlist_Prev( p_intf->p_sys->p_playlist ); -} - -void next_cb( GtkButton *button, gpointer user_data ) -{ - (void)user_data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); - playlist_Next( p_intf->p_sys->p_playlist ); -} - -void playlist_cb( GtkButton *button, gpointer user_data ) -{ - (void)user_data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); - if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_playlist_window) ) - { - gtk_widget_show_all( p_intf->p_sys->p_video_window ); - gtk_widget_hide_all( p_intf->p_sys->p_playlist_window ); - } - else - { - gtk_widget_hide_all( p_intf->p_sys->p_video_window ); - gtk_widget_show_all( p_intf->p_sys->p_playlist_window ); - } -} - -void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll, - gdouble value, gpointer data ) -{ - (void)scroll; (void)data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( range ) ); - if( p_intf->p_sys->p_input ) - { - int i_length = hildon_seekbar_get_total_time( p_intf->p_sys->p_seekbar ); - var_SetFloat( p_intf->p_sys->p_input, "position", (float)(value/i_length) ); - } -} - -void pl_row_activated_cb( GtkTreeView *tree_view , GtkTreePath *path, - GtkTreeViewColumn *column, gpointer user_data ) -{ - (void)column; (void)user_data; - intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( tree_view ) ); - input_item_t *p_input; - GtkTreeModel *model = gtk_tree_view_get_model( tree_view ); - GtkTreeIter iter; - gchar *filename = NULL; - - gtk_tree_model_get_iter( model, &iter, path ); - gtk_tree_model_get( model, &iter, 0, &filename, -1 ); - - p_input = input_item_New( filename, NULL ); - playlist_AddInput( p_intf->p_sys->p_playlist, p_input, - PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true, false ); - vlc_gc_decref( p_input ); -} - -void open_cb( GtkMenuItem *menuitem, gpointer user_data ) -{ - (void)menuitem; - intf_thread_t *p_intf = (intf_thread_t *)user_data; - input_item_t *p_input; - GtkWidget *dialog; - char *psz_filename = NULL; - -#ifdef HAVE_HILDON_FM - dialog = hildon_file_chooser_dialog_new( GTK_WINDOW( p_intf->p_sys->p_main_window ), - GTK_FILE_CHOOSER_ACTION_OPEN ); -#else - dialog = gtk_file_chooser_dialog_new( "Open File", GTK_WINDOW( p_intf->p_sys->p_main_window ), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, NULL ); -#endif - gtk_widget_show_all( GTK_WIDGET( dialog ) ); - - if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_OK ) - { - psz_filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); - } - else - { - gtk_widget_destroy( dialog ); - return; - } - - gtk_widget_destroy( dialog ); - - p_input = input_item_New( psz_filename, NULL ); - playlist_AddInput( p_intf->p_sys->p_playlist, p_input, - PLAYLIST_APPEND | PLAYLIST_GO, - PLAYLIST_END, true, false ); - vlc_gc_decref( p_input ); -} - -void open_address_cb( GtkMenuItem *menuitem, gpointer user_data ) -{ - (void)menuitem; - intf_thread_t *p_intf = (intf_thread_t *)user_data; - input_item_t *p_input; - GtkWidget *dialog, *hbox, *label, *entry; - - dialog = gtk_dialog_new_with_buttons( "Open Address", - GTK_WINDOW( p_intf->p_sys->p_main_window ), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_OK, GTK_RESPONSE_OK, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL ); - label = gtk_label_new( "Address :" ); - entry = gtk_entry_new(); - gtk_entry_set_width_chars( GTK_ENTRY( entry ), 30 ); - hbox = gtk_hbox_new( FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); - gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 ); - gtk_container_add( GTK_CONTAINER( GTK_DIALOG( dialog )->vbox ), hbox ); - - gtk_widget_show_all( dialog ); - if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_CANCEL ) - { - gtk_widget_destroy( dialog ); - return; - } - - p_input = input_item_New( gtk_entry_get_text( GTK_ENTRY( entry ) ), - NULL ); - playlist_AddInput( p_intf->p_sys->p_playlist, p_input, - PLAYLIST_APPEND | PLAYLIST_GO, - PLAYLIST_END, true, false ); - vlc_gc_decref( p_input ); - - gtk_widget_destroy( dialog ); -} - -void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data ) -{ - (void)menuitem; - intf_thread_t *p_intf = (intf_thread_t *)user_data; - input_item_t *p_input; - - p_input = input_item_New( "v4l2://", NULL ); - playlist_AddInput( p_intf->p_sys->p_playlist, p_input, - PLAYLIST_APPEND | PLAYLIST_GO, - PLAYLIST_END, true, false ); - vlc_gc_decref( p_input ); -} - -void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)user_data; - input_thread_t *p_input = p_intf->p_sys->p_input; - vout_thread_t *p_vout = p_input ? input_GetVout( p_input ) : NULL; - (void)menuitem; - - if( !p_vout ) - { - hildon_banner_show_information( - GTK_WIDGET( p_intf->p_sys->p_main_window ), - "gtk-dialog-error", "There is no video" ); - return; - } - - var_TriggerCallback( p_vout, "video-snapshot" ); - hildon_banner_show_information( GTK_WIDGET( p_intf->p_sys->p_main_window ), - NULL, "Snapshot taken" ); -} - -void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)user_data; - - if( gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM( menuitem ) ) ) - config_PutInt( p_intf, "avcodec-skip-frame", 1 ); - else - config_PutInt( p_intf, "avcodec-skip-frame", 0 ); -} - -static int keyModifiersToVLC( GdkEventKey *event ) -{ - int i_keyModifiers = 0; - if( event->state & GDK_SHIFT_MASK ) i_keyModifiers |= KEY_MODIFIER_SHIFT; - if( event->state & GDK_MOD1_MASK ) i_keyModifiers |= KEY_MODIFIER_ALT; - if( event->state & GDK_CONTROL_MASK ) i_keyModifiers |= KEY_MODIFIER_CTRL; - if( event->state & GDK_META_MASK ) i_keyModifiers |= KEY_MODIFIER_META; - return i_keyModifiers; -} - -static int eventToVLCKey( GdkEventKey *event ) -{ - int i_vlck = 0; - - switch( event->keyval ) - { - case GDK_Left: i_vlck |= KEY_LEFT; break; - case GDK_Right: i_vlck |= KEY_RIGHT; break; - case GDK_Up: i_vlck |= KEY_UP; break; - case GDK_Down: i_vlck |= KEY_DOWN; break; - case GDK_Escape: i_vlck |= KEY_ESC; break; - case GDK_Return: i_vlck |= KEY_ENTER; break; - - case GDK_F1: i_vlck |= KEY_F1; break; - case GDK_F2: i_vlck |= KEY_F2; break; - case GDK_F3: i_vlck |= KEY_F3; break; - case GDK_F4: i_vlck |= KEY_F4; break; - case GDK_F5: i_vlck |= KEY_F5; break; - case GDK_F6: i_vlck |= KEY_F6; break; - case GDK_F7: i_vlck |= KEY_F7; break; - case GDK_F8: i_vlck |= KEY_F8; break; - case GDK_F9: i_vlck |= KEY_F9; break; - case GDK_F10: i_vlck |= KEY_F10; break; - case GDK_F11: i_vlck |= KEY_F11; break; - case GDK_F12: i_vlck |= KEY_F12; break; - - case GDK_Page_Up: i_vlck |= KEY_PAGEUP; break; - case GDK_Page_Down: i_vlck |= KEY_PAGEDOWN; break; - case GDK_Home: i_vlck |= KEY_HOME; break; - case GDK_End: i_vlck |= KEY_END; break; - case GDK_Insert: i_vlck |= KEY_INSERT; break; - case GDK_Delete: i_vlck |= KEY_DELETE; break; - -#ifndef HAVE_MAEMO - case GDK_AudioLowerVolume: i_vlck |= KEY_VOLUME_DOWN; break; - case GDK_AudioRaiseVolume: i_vlck |= KEY_VOLUME_UP; break; - case GDK_AudioMute: i_vlck |= KEY_VOLUME_MUTE; break; - case GDK_AudioPlay: i_vlck |= KEY_MEDIA_PLAY_PAUSE; break; - case GDK_AudioStop: i_vlck |= KEY_MEDIA_STOP; break; - case GDK_AudioNext: i_vlck |= KEY_MEDIA_NEXT_TRACK; break; - case GDK_AudioPrev: i_vlck |= KEY_MEDIA_PREV_TRACK; break; -#endif - } - - if( !i_vlck ) - { - /* Force lowercase */ - if( event->keyval >= GDK_A && event->keyval <= GDK_Z ) - i_vlck = event->keyval + 32; - /* Rest of the ascii range */ - else if( event->keyval >= GDK_space && event->keyval <= GDK_asciitilde ) - i_vlck = event->keyval; - } - - /* Handle modifiers */ - i_vlck |= keyModifiersToVLC( event ); - - return i_vlck; -} - -gboolean key_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data) -{ - intf_thread_t *p_intf = (intf_thread_t *)user_data; - widget = widget; /* unused */ - - int i_vlck = eventToVLCKey( event ); - if( i_vlck > 0 ) - { - var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlck ); - return TRUE; - } - - return FALSE; -} - -gboolean fullscreen_cb( gpointer user_data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)user_data; - - if(p_intf->p_sys->b_fullscreen) - { - gtk_widget_hide_all( GTK_WIDGET( p_intf->p_sys->p_control_window ) ); - gtk_window_fullscreen( GTK_WINDOW(p_intf->p_sys->p_main_window) ); - } - else - { - gtk_window_unfullscreen( GTK_WINDOW(p_intf->p_sys->p_main_window) ); - gtk_widget_show_all( GTK_WIDGET( p_intf->p_sys->p_control_window ) ); - } - return FALSE; -} diff --git a/modules/gui/hildon/maemo_callbacks.h b/modules/gui/hildon/maemo_callbacks.h deleted file mode 100644 index 678134463e..0000000000 --- a/modules/gui/hildon/maemo_callbacks.h +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** -* maemo_callbacks.h : Callbacks header file for the maemo plugin. -***************************************************************************** -* Copyright (C) 2008 the VideoLAN team -* $Id$ -* -* Authors: Antoine Lejeune -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -*****************************************************************************/ - -#include - -#include -#include - -void play_cb( GtkButton *button, gpointer user_data ); -void stop_cb( GtkButton *button, gpointer user_data ); -void prev_cb( GtkButton *button, gpointer user_data ); -void next_cb( GtkButton *button, gpointer user_data ); -void playlist_cb( GtkButton *button, gpointer user_data ); -void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll, - gdouble value, gpointer data ); - -void pl_row_activated_cb( GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *, - gpointer ); - -void open_cb( GtkMenuItem *menuitem, gpointer user_data ); -void open_address_cb( GtkMenuItem *menuitem, gpointer user_data ); -void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data ); - -void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data ); -void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data ); - -gboolean key_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data); -gboolean fullscreen_cb(gpointer user_data); diff --git a/modules/gui/hildon/maemo_input.c b/modules/gui/hildon/maemo_input.c deleted file mode 100644 index 4f9fb0661f..0000000000 --- a/modules/gui/hildon/maemo_input.c +++ /dev/null @@ -1,223 +0,0 @@ -/***************************************************************************** - * maemo_input.c : Input handling for the maemo plugin - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "maemo.h" -#include "maemo_input.h" - -/***************************************************************************** - * Local prototypes. - *****************************************************************************/ -static void update_position( intf_thread_t *p_intf ); -static void item_changed( intf_thread_t *p_intf ); -static void item_changed_pl( intf_thread_t *p_intf ); - -static int input_event_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ); -static int interface_changed_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, - void *param ); -static gboolean process_events( gpointer data ); - -void set_input( intf_thread_t *p_intf, input_thread_t *p_input ); -void delete_input( intf_thread_t *p_intf ); - - - -/***************************************************************************** - * Functions. - *****************************************************************************/ -void post_event( intf_thread_t *p_intf, int i_event ) -{ - vlc_spin_lock( &p_intf->p_sys->event_lock ); - p_intf->p_sys->i_event |= i_event; - vlc_spin_unlock( &p_intf->p_sys->event_lock ); - g_idle_add( process_events, p_intf ); -} - -static gboolean process_events( gpointer data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)data; - int i_event; - - vlc_spin_lock( &p_intf->p_sys->event_lock ); - i_event = p_intf->p_sys->i_event; - p_intf->p_sys->i_event = 0; - vlc_spin_unlock( &p_intf->p_sys->event_lock ); - - if( !i_event ) return TRUE; - - if( i_event & EVENT_PLAYLIST_CURRENT ) - item_changed_pl( p_intf ); - if( i_event & EVENT_ACTIVITY ) - item_changed_pl( p_intf ); - if( i_event & EVENT_ITEM_CHANGED ) - item_changed( p_intf ); - if( i_event & EVENT_INTF_CHANGED ) - update_position( p_intf ); - - return FALSE; -} - -void set_input( intf_thread_t *p_intf, input_thread_t *p_input ) -{ - if( p_input && !( p_input->b_die || p_input->b_dead ) ) - { - p_intf->p_sys->p_input = p_input; - vlc_object_hold( p_input ); - var_AddCallback( p_input, "intf-event", input_event_cb, p_intf ); - - // "Activate" the seekbar - gtk_widget_set_sensitive( GTK_WIDGET( p_intf->p_sys->p_seekbar ), TRUE ); - } - else - p_intf->p_sys->p_input = NULL; -} - -void delete_input( intf_thread_t *p_intf ) -{ - if( p_intf->p_sys->p_input ) - { - var_DelCallback( p_intf->p_sys->p_input, "intf-event", - input_event_cb, p_intf ); - vlc_object_release( p_intf->p_sys->p_input ); - p_intf->p_sys->p_input = NULL; - - // Reset the seekbar - hildon_seekbar_set_position( p_intf->p_sys->p_seekbar, 0 ); - gtk_widget_set_sensitive( GTK_WIDGET( p_intf->p_sys->p_seekbar ), FALSE ); - } -} - -static void item_changed_pl( intf_thread_t *p_intf ) -{ - if( p_intf->p_sys->p_input && - ( p_intf->p_sys->p_input->b_dead || p_intf->p_sys->p_input->b_die ) ) - { - delete_input( p_intf ); - return; - } - - if( !p_intf->p_sys->p_input ) - { - set_input( p_intf, playlist_CurrentInput( p_intf->p_sys->p_playlist ) ); - } - return; -} - -int playlist_current_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ) -{ - intf_thread_t *p_intf = (intf_thread_t *)param; - (void)p_this; (void)psz_var; (void)oldval; (void)newval; - - vlc_spin_lock( &p_intf->p_sys->event_lock ); - p_intf->p_sys->i_event |= EVENT_PLAYLIST_CURRENT; - vlc_spin_unlock( &p_intf->p_sys->event_lock ); - g_idle_add( process_events, p_intf ); - return VLC_SUCCESS; -} - -int activity_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ) -{ - intf_thread_t *p_intf = (intf_thread_t *)param; - (void)p_this; (void)psz_var; (void)oldval; (void)newval; - - vlc_spin_lock( &p_intf->p_sys->event_lock ); - p_intf->p_sys->i_event |= EVENT_ACTIVITY; - vlc_spin_unlock( &p_intf->p_sys->event_lock ); - g_idle_add( process_events, p_intf ); - return VLC_SUCCESS; -} - -static void item_changed( intf_thread_t *p_intf ) -{ - GtkButton *p_button = GTK_BUTTON( p_intf->p_sys->p_play_button ); - vlc_value_t state; - - if( !p_intf->p_sys->p_input ) - return; - - var_Get( p_intf->p_sys->p_input, "state", &state ); - - // We change the "play" button - if( state.i_int == PLAYING_S ) - gtk_button_set_image( p_button, gtk_image_new_from_stock( "vlc-pause", - GTK_ICON_SIZE_BUTTON ) ); - else - gtk_button_set_image( p_button, gtk_image_new_from_stock( "vlc-play", - GTK_ICON_SIZE_BUTTON ) ); -} - -int item_changed_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ) -{ - (void)p_this; (void)psz_var; (void)oldval; (void)newval; - intf_thread_t *p_intf = (intf_thread_t *)param; - - vlc_spin_lock( &p_intf->p_sys->event_lock ); - p_intf->p_sys->i_event |= EVENT_ITEM_CHANGED; - vlc_spin_unlock( &p_intf->p_sys->event_lock ); - g_idle_add( process_events, p_intf ); - return VLC_SUCCESS; -} - -static void update_position( intf_thread_t *p_intf ) -{ - if( p_intf->p_sys->p_input ) - { - hildon_seekbar_set_total_time( p_intf->p_sys->p_seekbar, - var_GetTime( p_intf->p_sys->p_input, "length" )/1000000 ); - hildon_seekbar_set_position( p_intf->p_sys->p_seekbar, - var_GetTime( p_intf->p_sys->p_input, "time" )/1000000 ); - } -} - -static int interface_changed_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, - void *param ) -{ - intf_thread_t *p_intf = (intf_thread_t *)param; - (void)p_this; (void)psz_var; (void)oldval; (void)newval; - - vlc_spin_lock( &p_intf->p_sys->event_lock ); - p_intf->p_sys->i_event |= EVENT_INTF_CHANGED; - vlc_spin_unlock( &p_intf->p_sys->event_lock ); - g_idle_add( process_events, p_intf ); - return VLC_SUCCESS; -} - -static int input_event_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ) -{ - if( newval.i_int == INPUT_EVENT_STATE ) - return item_changed_cb( p_this, psz_var, oldval, newval, param ); - else - return interface_changed_cb( p_this, psz_var, oldval, newval, param ); -} diff --git a/modules/gui/hildon/maemo_input.h b/modules/gui/hildon/maemo_input.h deleted file mode 100644 index 2286c698f9..0000000000 --- a/modules/gui/hildon/maemo_input.h +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - * maemo_input.h : Input handling header file for the maemo plugin. - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#include - -#include -#include - -#define EVENT_ITEM_STATE_CHANGE (1<<0) -#define EVENT_PLAYLIST_CURRENT (1<<1) -#define EVENT_ACTIVITY (1<<2) -#define EVENT_ITEM_CHANGED (1<<3) -#define EVENT_INTF_CHANGED (1<<4) - -void post_event( intf_thread_t *p_intf, int event ); - -void set_input( intf_thread_t *p_intf, input_thread_t *p_input ); -void delete_input( intf_thread_t *p_intf ); - -int playlist_current_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ); -int activity_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ); - -int item_changed_cb( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *param ); diff --git a/modules/gui/hildon/maemo_interface.c b/modules/gui/hildon/maemo_interface.c deleted file mode 100644 index b6a2bd72a3..0000000000 --- a/modules/gui/hildon/maemo_interface.c +++ /dev/null @@ -1,155 +0,0 @@ -/***************************************************************************** - * maemo_interface.c : Interface creation of the maemo plugin - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#include - -#include - -#include "maemo.h" -#include "maemo_callbacks.h" -#include "maemo_interface.h" -#include "maemo_input.h" - -static void scan_maemo_for_media ( intf_thread_t *p_intf ); -static void find_media_in_dir ( const char *psz_dir, GList **pp_list ); - -static const char *ppsz_extensions[] = - { "aac", "flac", "m4a", "m4p", "mka", "mp1", "mp2", "mp3", - "ogg", "wav", "wma", "asf", "avi", "divx", "flv", "m1v", - "m2v", "m4v", "mkv", "mov", "mpeg", "mpeg1", "mpeg2", "mpeg4", - "mpg", "ogm", "wmv", NULL }; - -static const char *ppsz_media_dirs[] = - { "/media/mmc1", "/media/mmc2", "/home/user/MyDocs/.videos", NULL }; - -void create_playlist( intf_thread_t *p_intf ) -{ - GtkWidget *playlist; - GtkWidget *scroll; - GtkListStore *playlist_store; - GtkTreeViewColumn *col; - GtkCellRenderer *renderer; - - playlist = gtk_tree_view_new(); - - playlist_store = gtk_list_store_new( 1, G_TYPE_STRING ); - p_intf->p_sys->p_playlist_store = playlist_store; - - gtk_tree_view_set_model( GTK_TREE_VIEW( playlist ), - GTK_TREE_MODEL( playlist_store ) ); - - renderer = gtk_cell_renderer_text_new(); - col = gtk_tree_view_column_new_with_attributes( "File", renderer, - "text", 0, NULL ); - gtk_tree_view_append_column( GTK_TREE_VIEW( playlist ), col ); - - g_object_set( playlist, "headers-visible", TRUE, NULL ); - scan_maemo_for_media( p_intf ); - - scroll = gtk_scrolled_window_new( NULL, NULL ); - gtk_container_add( GTK_CONTAINER( scroll ), playlist ); - - p_intf->p_sys->p_playlist_window = scroll; - - g_signal_connect( playlist, "row-activated", - G_CALLBACK( pl_row_activated_cb ), NULL ); - - // Set callback with the vlc core - var_AddCallback( p_intf->p_sys->p_playlist, "item-change", - item_changed_cb, p_intf ); - var_AddCallback( p_intf->p_sys->p_playlist, "item-current", - playlist_current_cb, p_intf ); - var_AddCallback( p_intf->p_sys->p_playlist, "activity", - activity_cb, p_intf ); -} - -void delete_playlist( intf_thread_t *p_intf ) -{ - var_DelCallback( p_intf->p_sys->p_playlist, "item-change", - item_changed_cb, p_intf ); - var_DelCallback( p_intf->p_sys->p_playlist, "item-current", - playlist_current_cb, p_intf ); - var_DelCallback( p_intf->p_sys->p_playlist, "activity", - activity_cb, p_intf ); -} - -static void scan_maemo_for_media( intf_thread_t *p_intf ) -{ - GtkListStore *playlist_store = GTK_LIST_STORE( p_intf->p_sys->p_playlist_store ); - GList *list = NULL; - GtkTreeIter iter; - - for( int i = 0; ppsz_media_dirs[i]; i++ ) - { - find_media_in_dir( ppsz_media_dirs[i], &list ); - msg_Dbg( p_intf, "Looking for media in %s", ppsz_media_dirs[i] ); - } - - list = g_list_first( list ); - while( list ) - { - msg_Dbg( p_intf, "Adding : %s", (char *)list->data ); - gtk_list_store_append( playlist_store, &iter ); - gtk_list_store_set( playlist_store, &iter, - 0, list->data, -1 ); - list = g_list_next( list ); - } -} - -static void find_media_in_dir( const char *psz_dir, GList **pp_list ) -{ - GDir *dir = NULL; - const gchar *psz_name; - char *psz_path; - - dir = g_dir_open( psz_dir, 0, NULL ); - if( !dir ) - return; - while( ( psz_name = g_dir_read_name( dir ) ) != NULL ) - { - psz_path = g_build_path( "/", psz_dir, psz_name, NULL ); - if( g_file_test( psz_path, G_FILE_TEST_IS_DIR ) && - !g_file_test( psz_path, G_FILE_TEST_IS_SYMLINK ) ) - find_media_in_dir( psz_path, pp_list ); - else - { - char *psz_ext = strrchr( psz_name, '.' ); - if( psz_ext ) - { - psz_ext++; - for( int i = 0; ppsz_extensions[i]; i++ ) - { - if( strcmp( psz_ext, ppsz_extensions[i] ) == 0 ) - { - *pp_list = g_list_append( *pp_list, g_strdup( psz_path ) ); - break; - } - } - } - } - g_free( psz_path ); - } - - g_dir_close( dir ); - return; -} diff --git a/modules/gui/hildon/maemo_interface.h b/modules/gui/hildon/maemo_interface.h deleted file mode 100644 index 319b14e6dd..0000000000 --- a/modules/gui/hildon/maemo_interface.h +++ /dev/null @@ -1,29 +0,0 @@ -/***************************************************************************** - * maemo_interface.h : Interface creation header file for the maemo plugin. - ***************************************************************************** - * Copyright (C) 2008 the VideoLAN team - * $Id$ - * - * Authors: Antoine Lejeune - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#include - -#include - -void create_playlist( intf_thread_t *p_intf ); -void delete_playlist( intf_thread_t *p_intf ); diff --git a/modules/gui/hildon/maemo_menus.c b/modules/gui/hildon/maemo_menus.c deleted file mode 100644 index 71f17fcb14..0000000000 --- a/modules/gui/hildon/maemo_menus.c +++ /dev/null @@ -1,682 +0,0 @@ -/***************************************************************************** - * maemo_menus.c : menus creation for the maemo plugin - ***************************************************************************** - * Copyright (C) 2010 the VideoLAN team - * $Id$ - * - * Authors: Gildas Bazin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -#include -#include - -#include - -#include "maemo.h" -#include "maemo_callbacks.h" - -/***************************************************************************** - * Local prototypes - *****************************************************************************/ -static GtkMenu *Populate( intf_thread_t *p_intf, GtkMenu *menu, - const char **varnames, vlc_object_t **objects, - unsigned int elements ); - -/***************************************************************************** - * Utility functions - *****************************************************************************/ -static input_thread_t *get_input(intf_thread_t *p_intf) -{ - return p_intf->p_sys->p_input; -} - -static vlc_object_t *get_vout(intf_thread_t *p_intf) -{ - return (vlc_object_t *)(p_intf->p_sys->p_input ? - input_GetVout( p_intf->p_sys->p_input ) : 0); -} - -static vlc_object_t *get_aout(intf_thread_t *p_intf) -{ - return (vlc_object_t *)(p_intf->p_sys->p_input ? - input_GetAout( p_intf->p_sys->p_input ) : 0); -} - -static gint quit_event( GtkWidget *widget, gpointer data ) -{ - intf_thread_t *p_intf = (intf_thread_t *)data; - (void)widget; - libvlc_Quit( p_intf->p_libvlc ); - return TRUE; -} - -/***************************************************************************** - * Definitions of variables for the dynamic menus - *****************************************************************************/ -#define SIZE_LIST 20 - -#define PUSH_VAR( var ) \ - ppsz_varnames[index] = var; \ - p_objects[index] = VLC_OBJECT(p_object); \ - if(index < SIZE_LIST - 1) index++; \ - ppsz_varnames[index] = 0; p_objects[index] = 0; - -#define PUSH_INPUTVAR( var ) \ - ppsz_varnames[index] = var; \ - p_objects[index] = VLC_OBJECT(p_input); \ - if(index < SIZE_LIST - 1) index++; \ - ppsz_varnames[index] = 0; p_objects[index] = 0; - -#define ADD_MENU_ITEM( label, callback ) \ - item = gtk_menu_item_new_with_label( label ); \ - gtk_menu_append( main_menu, item ); \ - g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( callback ), \ - p_intf ); - -#define ADD_SEPARATOR() \ - item = gtk_separator_menu_item_new(); \ - gtk_menu_append( main_menu, item ); - - - -static GtkMenu *create_video_menu( intf_thread_t *p_intf ) -{ - vlc_object_t *p_object = get_vout(p_intf); - input_thread_t *p_input = get_input(p_intf);; - - vlc_object_t *p_objects[SIZE_LIST]; - const char *ppsz_varnames[SIZE_LIST]; - int index = 0; - - PUSH_INPUTVAR( "video-es" ); - PUSH_INPUTVAR( "spu-es" ); - PUSH_VAR( "fullscreen" ); - PUSH_VAR( "video-wallpaper" ); - PUSH_VAR( "video-snapshot" ); - PUSH_VAR( "zoom" ); - PUSH_VAR( "autoscale" ); - PUSH_VAR( "aspect-ratio" ); - PUSH_VAR( "crop" ); - PUSH_VAR( "deinterlace" ); - PUSH_VAR( "deinterlace-mode" ); - PUSH_VAR( "postprocess" ); - - GtkWidget *menu = gtk_menu_new(); - return Populate( p_intf, GTK_MENU(menu), ppsz_varnames, p_objects, index ); -} - -static GtkMenu *create_audio_menu( intf_thread_t *p_intf ) -{ - vlc_object_t *p_object = get_aout(p_intf); - input_thread_t *p_input = get_input(p_intf);; - - vlc_object_t *p_objects[SIZE_LIST]; - const char *ppsz_varnames[SIZE_LIST]; - int index = 0; - - PUSH_INPUTVAR( "audio-es" ); - PUSH_VAR( "audio-channels" ); - PUSH_VAR( "audio-device" ); - PUSH_VAR( "visual" ); - - GtkWidget *menu = gtk_menu_new(); - return Populate( p_intf, GTK_MENU(menu), ppsz_varnames, p_objects, index ); -} - -static GtkMenu *create_input_menu( intf_thread_t *p_intf ) -{ - input_thread_t *p_object = get_input(p_intf); - - vlc_object_t *p_objects[SIZE_LIST]; - const char *ppsz_varnames[SIZE_LIST]; - int index = 0; - - PUSH_VAR( "bookmark" ); - PUSH_VAR( "title" ); - PUSH_VAR( "chapter" ); - PUSH_VAR( "navigation" ); - PUSH_VAR( "program" ); - - GtkWidget *menu = gtk_menu_new(); - return Populate( p_intf, GTK_MENU(menu), ppsz_varnames, p_objects, index ); -} - -static void toplevel_menu_callback(GtkMenuItem *menuitem, gpointer data) -{ - intf_thread_t *p_intf = (intf_thread_t *)data; - GtkMenu *(*pf_menu)(intf_thread_t *) = 0; - GtkMenu *menu; - - if(menuitem == p_intf->p_sys->menu_input) pf_menu = create_input_menu; - else if(menuitem == p_intf->p_sys->menu_audio) pf_menu = create_audio_menu; - else if(menuitem == p_intf->p_sys->menu_video) pf_menu = create_video_menu; - else return; - - menu = GTK_MENU(gtk_menu_item_get_submenu(menuitem)); - if(menu) gtk_object_destroy( GTK_OBJECT(menu) ); - menu = pf_menu(p_intf); - gtk_menu_item_set_submenu(menuitem, GTK_WIDGET(menu)); - gtk_widget_show_all( GTK_WIDGET(menuitem) ); -} - -GtkWidget *create_menu( intf_thread_t *p_intf ) -{ - intf_sys_t *p_sys = p_intf->p_sys; - GtkWidget *main_menu, *item; - - /* Creating the main menu */ - main_menu = gtk_menu_new(); - - /* Filling the menu */ - ADD_MENU_ITEM( "Open", open_cb ); - ADD_MENU_ITEM( "Open Address", open_address_cb ); - ADD_MENU_ITEM( "Open Webcam", open_webcam_cb ); - ADD_SEPARATOR(); - - item = gtk_menu_item_new_with_label ("Playback"); - p_sys->menu_input = GTK_MENU_ITEM(item); - gtk_menu_bar_append(main_menu, item); - g_signal_connect( GTK_OBJECT(item), "activate", - G_CALLBACK( toplevel_menu_callback ), p_intf ); - - item = gtk_menu_item_new_with_label ("Audio"); - p_sys->menu_audio = GTK_MENU_ITEM(item); - gtk_menu_bar_append(main_menu, item); - g_signal_connect( GTK_OBJECT(item), "activate", - G_CALLBACK( toplevel_menu_callback ), p_intf ); - - item = gtk_menu_item_new_with_label ("Video"); - p_sys->menu_video = GTK_MENU_ITEM(item); - gtk_menu_bar_append(main_menu, item); - g_signal_connect( GTK_OBJECT(item), "activate", - G_CALLBACK( toplevel_menu_callback ), p_intf ); - - toplevel_menu_callback(p_sys->menu_input, p_intf); - toplevel_menu_callback(p_sys->menu_video, p_intf); - toplevel_menu_callback(p_sys->menu_audio, p_intf); - - ADD_SEPARATOR(); - ADD_MENU_ITEM( "Exit", quit_event ); - - gtk_widget_show_all( main_menu ); - return main_menu; -} - -/************************************************************************* - * Builders for automenus - *************************************************************************/ -enum -{ - ITEM_NORMAL, - ITEM_CHECK, - ITEM_RADIO -}; - -typedef struct VlcMenuItemClass -{ - GtkRadioMenuItemClass menuitemclass; - -} VlcMenuItemClass; - -typedef struct VlcMenuItem -{ - GtkRadioMenuItem menuitem; - - vlc_object_t *p_obj; - int i_type; - vlc_value_t val; - const char *psz_var; - -} VlcMenuItem; - -static void vlc_menu_item_destroy (GtkObject *object) -{ - VlcMenuItem *menuitem = (VlcMenuItem *)object; - - if(menuitem->i_type == VLC_VAR_STRING && menuitem->val.psz_string) - free(menuitem->val.psz_string); - gtk_object_destroy( object ); -} - -static void vlc_menu_item_class_init (VlcMenuItemClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass*)klass; - object_class->destroy = vlc_menu_item_destroy; -} - -static void vlc_menu_item_init (VlcMenuItem *menuitem){(void)menuitem;} - -static GtkType vlc_menu_item_get_type (void) -{ - static GtkType vlc_menu_item_type = 0; - - if (!vlc_menu_item_type) - { - static const GtkTypeInfo vlc_menu_item_info = - { - (char *)"VlcMenuItem", - sizeof (VlcMenuItem), - sizeof (VlcMenuItemClass), - (GtkClassInitFunc) vlc_menu_item_class_init, - (GtkObjectInitFunc) vlc_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - vlc_menu_item_type = gtk_type_unique (GTK_TYPE_MENU_ITEM, &vlc_menu_item_info); - } - - return vlc_menu_item_type; -} - -static GtkType vlc_check_menu_item_get_type (void) -{ - static GtkType vlc_check_menu_item_type = 0; - - if (!vlc_check_menu_item_type) - { - static const GtkTypeInfo vlc_check_menu_item_info = - { - (char *)"VlcCheckMenuItem", - sizeof (VlcMenuItem), - sizeof (VlcMenuItemClass), - (GtkClassInitFunc) vlc_menu_item_class_init, - (GtkObjectInitFunc) vlc_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - vlc_check_menu_item_type = gtk_type_unique (GTK_TYPE_CHECK_MENU_ITEM, &vlc_check_menu_item_info); - } - - return vlc_check_menu_item_type; -} - -static GtkType vlc_radio_menu_item_get_type (void) -{ - static GtkType vlc_radio_menu_item_type = 0; - - if (!vlc_radio_menu_item_type) - { - static const GtkTypeInfo vlc_radio_menu_item_info = - { - (char *)"VlcRadioMenuItem", - sizeof (VlcMenuItem), - sizeof (VlcMenuItemClass), - (GtkClassInitFunc) vlc_menu_item_class_init, - (GtkObjectInitFunc) vlc_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - vlc_radio_menu_item_type = gtk_type_unique (GTK_TYPE_RADIO_MENU_ITEM, &vlc_radio_menu_item_info); - } - - return vlc_radio_menu_item_type; -} - -static GtkWidget *vlc_menu_item_new (vlc_object_t *p_obj, int i_type, - vlc_value_t val, const char *var) -{ - VlcMenuItem *item; - - switch(i_type) - { - case ITEM_CHECK: - item = (VlcMenuItem *)gtk_type_new (vlc_check_menu_item_get_type ()); - break; - case ITEM_RADIO: - item = (VlcMenuItem *)gtk_type_new (vlc_radio_menu_item_get_type ()); - break; - default: - item = (VlcMenuItem *)gtk_type_new (vlc_menu_item_get_type ()); - break; - } - item->p_obj = p_obj; - item->i_type = i_type; - item->val = val; - item->psz_var = var; - return GTK_WIDGET (item); -} - -/****/ - -static int CreateChoicesMenu( intf_thread_t *p_intf, GtkMenu *submenu, const char *psz_var, - vlc_object_t *p_object, bool b_root ); - -static void menu_callback(GtkMenuItem *menuitem, gpointer user_data) -{ - VlcMenuItem *item = (VlcMenuItem *)menuitem; - vlc_object_t *p_object = item->p_obj; - (void)user_data; - if( p_object == NULL ) return; - var_Set( p_object, item->psz_var, item->val ); -} - -static void CreateAndConnect( intf_thread_t *p_intf, - GtkMenu *menu, const char *psz_var, - const char *text, const char *help, - int i_item_type, vlc_object_t *p_obj, - vlc_value_t val, int i_val_type, - bool checked ) -{ - GtkMenuItem *menu_item = - (GtkMenuItem *)vlc_menu_item_new (p_obj, i_item_type, val, psz_var ); - - (void)help; (void)i_val_type; - -#if GTK_CHECK_VERSION(2,16,0) - gtk_menu_item_set_label (menu_item, text ? text : psz_var); -#else - GtkWidget *accel_label = gtk_accel_label_new(text ? text : psz_var); - gtk_misc_set_alignment(GTK_MISC (accel_label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (menu_item), accel_label); - gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), GTK_WIDGET(menu_item)); - gtk_widget_show (accel_label); -#endif /* GTK_CHECK_VERSION(2,16,0) */ - - gtk_menu_append( GTK_WIDGET(menu), GTK_WIDGET(menu_item) ); - - if( i_item_type == ITEM_CHECK || i_item_type == ITEM_RADIO ) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), checked); - - g_signal_connect( GTK_OBJECT(menu_item), "activate", G_CALLBACK( menu_callback ), - p_intf ); -} - -static bool IsMenuEmpty( const char *psz_var, - vlc_object_t *p_object, - bool b_root ) -{ - vlc_value_t val, val_list; - int i_type, i_result, i; - - /* Check the type of the object variable */ - i_type = var_Type( p_object, psz_var ); - - /* Check if we want to display the variable */ - if( !( i_type & VLC_VAR_HASCHOICE ) ) return false; - - var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL ); - if( val.i_int == 0 ) return true; - - if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE ) - { - if( val.i_int == 1 && b_root ) return true; - else return false; - } - - /* Check children variables in case of VLC_VAR_VARIABLE */ - if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 ) - { - return true; - } - - for( i = 0, i_result = true; i < val_list.p_list->i_count; i++ ) - { - if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string, - p_object, false ) ) - { - i_result = false; - break; - } - } - - /* clean up everything */ - var_FreeList( &val_list, NULL ); - - return i_result; -} - -static void UpdateItem( intf_thread_t *p_intf, GtkMenu *menu, - const char *psz_var, vlc_object_t *p_object, bool b_submenu ) -{ - vlc_value_t val, text; - int i_type; - - /* Check the type of the object variable */ - /* This HACK is needed so we have a radio button for audio and video tracks - instread of a checkbox */ - if( !strcmp( psz_var, "audio-es" ) - || !strcmp( psz_var, "video-es" ) ) - i_type = VLC_VAR_INTEGER | VLC_VAR_HASCHOICE; - else - i_type = var_Type( p_object, psz_var ); - - switch( i_type & VLC_VAR_TYPE ) - { - case VLC_VAR_VOID: - case VLC_VAR_BOOL: - case VLC_VAR_VARIABLE: - case VLC_VAR_STRING: - case VLC_VAR_INTEGER: - case VLC_VAR_FLOAT: - break; - default: - /* Variable doesn't exist or isn't handled */ - return; - } - - /* Make sure we want to display the variable */ - if( !g_list_length(GTK_MENU_SHELL(menu)->children) && IsMenuEmpty( psz_var, p_object, true ) ) - { - return; - } - - /* Get the descriptive name of the variable */ - int i_ret = var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL ); - if( i_ret != VLC_SUCCESS ) - { - text.psz_string = NULL; - } - - /* Some specific stuff */ - bool forceDisabled = false; - if( !strcmp( psz_var, "spu-es" ) ) - { - vlc_object_t *p_vout = get_vout(p_intf); - forceDisabled = ( p_vout == NULL ); - if( p_vout ) vlc_object_release( p_vout ); - } - - if( i_type & VLC_VAR_HASCHOICE ) - { - /* Append choices menu */ - if( b_submenu ) - { - GtkWidget *item = - gtk_menu_item_new_with_label( text.psz_string ? text.psz_string : psz_var ); - GtkWidget *submenu = gtk_menu_new( ); - gtk_menu_append( menu, item ); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); - if( CreateChoicesMenu( p_intf, GTK_MENU(submenu), psz_var, p_object, true ) ) - gtk_widget_set_sensitive(item, false); - - if( forceDisabled ) - gtk_widget_set_sensitive(item, false); - } - else - { - - if( CreateChoicesMenu( p_intf, menu, psz_var, p_object, true ) ) - gtk_widget_set_sensitive(menu, false); - } - FREENULL( text.psz_string ); - return; - } - - switch( i_type & VLC_VAR_TYPE ) - { - case VLC_VAR_VOID: - var_Get( p_object, psz_var, &val ); - CreateAndConnect( p_intf, menu, psz_var, text.psz_string, "", - ITEM_NORMAL, p_object, val, i_type, false ); - break; - - case VLC_VAR_BOOL: - var_Get( p_object, psz_var, &val ); - val.b_bool = !val.b_bool; - CreateAndConnect( p_intf, menu, psz_var, text.psz_string, "", - ITEM_CHECK, p_object, val, i_type, !val.b_bool ); - break; - } - FREENULL( text.psz_string ); -} - -/** HACK for the navigation submenu: - * "title %2i" variables take the value 0 if not set - */ -static bool CheckTitle( vlc_object_t *p_object, const char *psz_var ) -{ - int i_title = 0; - if( sscanf( psz_var, "title %2i", &i_title ) <= 0 ) - return true; - - int i_current_title = var_GetInteger( p_object, "title" ); - return ( i_title == i_current_title ); -} - - -static int CreateChoicesMenu( intf_thread_t *p_intf, GtkMenu *submenu, const char *psz_var, - vlc_object_t *p_object, bool b_root ) -{ - vlc_value_t val, val_list, text_list; - int i_type, i; - - /* Check the type of the object variable */ - i_type = var_Type( p_object, psz_var ); - - /* Make sure we want to display the variable */ - if( !g_list_length(GTK_MENU_SHELL(submenu)->children) && - IsMenuEmpty( psz_var, p_object, b_root ) ) - return VLC_EGENERIC; - - switch( i_type & VLC_VAR_TYPE ) - { - case VLC_VAR_VOID: - case VLC_VAR_BOOL: - case VLC_VAR_VARIABLE: - case VLC_VAR_STRING: - case VLC_VAR_INTEGER: - case VLC_VAR_FLOAT: - break; - default: - /* Variable doesn't exist or isn't handled */ - return VLC_EGENERIC; - } - - if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, - &val_list, &text_list ) < 0 ) - { - return VLC_EGENERIC; - } - -#define CURVAL val_list.p_list->p_values[i] -#define CURTEXT text_list.p_list->p_values[i].psz_string - - for( i = 0; i < val_list.p_list->i_count; i++ ) - { - vlc_value_t another_val; - char string[16] = {0}; - char *menutext = string; - - switch( i_type & VLC_VAR_TYPE ) - { - case VLC_VAR_VARIABLE: - { - GtkWidget *subsubmenu = gtk_menu_new(); - GtkWidget *submenuitem = - gtk_menu_item_new_with_label( CURTEXT ? CURTEXT : CURVAL.psz_string ); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), subsubmenu); - gtk_menu_append( submenu, submenuitem ); - CreateChoicesMenu( p_intf, GTK_MENU(subsubmenu), CURVAL.psz_string, p_object, false ); - break; - } - - case VLC_VAR_STRING: - var_Get( p_object, psz_var, &val ); - another_val.psz_string = strdup( CURVAL.psz_string ); - menutext = CURTEXT ? CURTEXT : another_val.psz_string; - CreateAndConnect( p_intf, submenu, psz_var, menutext, "", - ITEM_RADIO, p_object, another_val, i_type, - val.psz_string && !strcmp( val.psz_string, CURVAL.psz_string ) ); - free( val.psz_string ); - break; - - case VLC_VAR_INTEGER: - var_Get( p_object, psz_var, &val ); - if( CURTEXT ) menutext = CURTEXT; - else snprintf( menutext, sizeof(string)-1, "%"PRId64, CURVAL.i_int ); - CreateAndConnect( p_intf, submenu, psz_var, menutext, "", - ITEM_RADIO, p_object, CURVAL, i_type, - ( CURVAL.i_int == val.i_int ) - && CheckTitle( p_object, psz_var ) ); - break; - - case VLC_VAR_FLOAT: - var_Get( p_object, psz_var, &val ); - if( CURTEXT ) menutext = CURTEXT; - else snprintf( menutext, sizeof(string)-1, "%.2f", CURVAL.f_float ); - CreateAndConnect( p_intf, submenu, psz_var, menutext, "", - ITEM_RADIO, p_object, CURVAL, i_type, - CURVAL.f_float == val.f_float ); - break; - - default: - break; - } - } - - /* clean up everything */ - var_FreeList( &val_list, &text_list ); - -#undef CURVAL -#undef CURTEXT - return !g_list_length(GTK_MENU_SHELL(submenu)->children) ? VLC_EGENERIC : VLC_SUCCESS; -} - -static GtkMenu *Populate( intf_thread_t *p_intf, GtkMenu *menu, - const char **varnames, vlc_object_t **objects, - unsigned int elements) -{ - for( unsigned int i = 0; i < elements ; i++ ) - { - if( (!varnames[i] || !*varnames[i]) && - g_list_length(GTK_MENU_SHELL(menu)->children) ) - { - gtk_menu_append( menu, gtk_separator_menu_item_new() ); - continue; - } - - if( objects[i] ) - { - UpdateItem( p_intf, menu, varnames[i], objects[i], true ); - } - } - - if(!g_list_length(GTK_MENU_SHELL(menu)->children)) - { - GtkWidget *menuitem = gtk_menu_item_new_with_label( "Empty" ); - gtk_menu_append( menu, menuitem ); - gtk_widget_set_sensitive(menuitem, false); - } - - return menu; -} diff --git a/po/POTFILES.in b/po/POTFILES.in index bd2e832428..006371dd64 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -505,7 +505,6 @@ modules/demux/vobsub.c modules/demux/voc.c modules/demux/wav.c modules/demux/xa.c -modules/gui/hildon/maemo.c modules/gui/macosx/about.h modules/gui/macosx/about.m modules/gui/macosx/AppleRemote.h diff --git a/share/Makefile.am b/share/Makefile.am index 83ca797542..c923bb48ff 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -50,7 +50,6 @@ EXTRA_DIST += \ $(DIST_lua) \ osdmenu/default.cfg.in \ $(DIST_osdmenu_default) \ - $(DIST_maemo) \ $(DIST_solid) CLEANFILES += osdmenu/default.cfg @@ -64,9 +63,6 @@ nobase_vlcdata_DATA += \ osdmenu/default.cfg \ $(DIST_osdmenu_default) endif -if BUILD_HILDON -nobase_vlcdata_DATA += $(DIST_maemo) $(maemo_FILES) -endif if KDE_SOLID soliddata_DATA = $(DIST_solid) endif @@ -388,20 +384,6 @@ DIST_http_lua = \ lua/http/js/jquery-ui-1.8.13.custom.min.js \ lua/http/old/style.css -DIST_maemo = \ - maemo/vlc_intf.rc \ - maemo/vlc_left_tab_active.png \ - maemo/vlc_left_tab_passive.png \ - maemo/playlist.png \ - maemo/play.png \ - maemo/pause.png \ - maemo/stop.png \ - maemo/previous.png \ - maemo/next.png - -maemo_FILES = \ - icons/32x32/vlc.png - DIST_solid = \ solid/vlc-opencda.desktop \ solid/vlc-opendvd.desktop \ diff --git a/share/maemo/next.png b/share/maemo/next.png deleted file mode 100644 index 8ade7e23a07001c86e082d0982b17a84c739c25f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`I-V|$Ar_~T6C_wqJg{d?D(L+0 y()G~vfxTc73-1qqhn{VE3p996h)T0gVPG(?RJ+wT%`g+FkHOQ`&t;ucLK6Vs6dX7J diff --git a/share/maemo/pause.png b/share/maemo/pause.png deleted file mode 100644 index 63deaa15220b85d25834bea65df35562aeb164bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`lAbP(Ar}702@=yD*b5y~Zxim3 fGRQjM!NPE1vgzr0KmKR}6)||a`njxgN@xNA)Ug%B diff --git a/share/maemo/play.png b/share/maemo/play.png deleted file mode 100644 index 764981a8d14d1ae0c8862ce16be6c4118a260e37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`x}GkMAr_~T6C`pT*oy?`Fx+JO zd%RK8tRbWMpKzz9*@OQLI~)FObof8Tf`ySGkH>A7S67SzP$PqOd^T!2~3Ct6mZWQcFEu978-hlYjjG|9`9b{5N6q zpU$bBmH2FCZ1whwjD~k=e$SN7k!Pv>|BqAn?~ji^kN4}_*VX*}`T6$w`S_vQ2bje5vX^L_i* UV-M870v*iY>FVdQ&MBb@0M=x3Qvd(} diff --git a/share/maemo/vlc_left_tab_passive.png b/share/maemo/vlc_left_tab_passive.png deleted file mode 100644 index e29120a579e118b2d073faef4a2b0a4f462c892f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^>Od^T!2~3Ct6mZWQWHE~978;gC;$2X|Nr@T`}}*m zzP@{Nv=|8k;vYHZp70oH>%6lEN~vfGzV*_w@6BfBtoim@qr! zc~Hvhf6lv8RepGWR5i`HyS04wtVtGbc5cU*ih&}|H!u6{1-oD!M<+NWN9 -- 2.39.2