]> git.sesse.net Git - vlc/commitdiff
Lua dialogs: introduce "dlg:flush()"
authorJean-Philippe André <jpeg@videolan.org>
Wed, 3 Feb 2010 09:48:55 +0000 (10:48 +0100)
committerJean-Philippe André <jpeg@videolan.org>
Wed, 3 Feb 2010 16:13:59 +0000 (17:13 +0100)
After the next commit, you'll have to flush a dialog in order to
update it immediately on the screen.
Flush sends an update signal to the UI dialog provider.

modules/misc/lua/libs/dialog.c

index e8dc5e2fc0da2bddeae449d7661817c5211f4777..2e26cc9da72c2247405ed1aaef749d2dc15c230c 100644 (file)
@@ -52,6 +52,7 @@ static int vlclua_dialog_create( lua_State *L );
 static int vlclua_dialog_delete( lua_State *L );
 static int vlclua_dialog_show( lua_State *L );
 static int vlclua_dialog_hide( lua_State *L );
+static int vlclua_dialog_flush( lua_State *L );
 
 static int vlclua_dialog_add_button( lua_State *L );
 static int vlclua_dialog_add_label( lua_State *L );
@@ -98,6 +99,7 @@ static const luaL_Reg vlclua_dialog_reg[] = {
     { "show", vlclua_dialog_show },
     { "hide", vlclua_dialog_hide },
     { "close", vlclua_dialog_delete },
+    { "flush", vlclua_dialog_flush },
 
     { "add_button", vlclua_dialog_add_button },
     { "add_label", vlclua_dialog_add_label },
@@ -311,6 +313,22 @@ static int vlclua_dialog_hide( lua_State *L )
 }
 
 
+/** Flush the dialog */
+static int vlclua_dialog_flush( lua_State *L )
+{
+    vlc_object_t *p_mgr = vlclua_get_this( L );
+
+    extension_dialog_t **pp_dlg =
+            (extension_dialog_t**) luaL_checkudata( L, 1, "dialog" );
+    if( !pp_dlg || !*pp_dlg )
+        return luaL_error( L, "Can't get pointer to dialog" );
+    extension_dialog_t *p_dlg = *pp_dlg;
+
+    dialog_ExtensionUpdate( p_mgr, p_dlg );
+
+    return 1;
+}
+
 /**
  * Create a button: add_button
  * Arguments: text, function (as string)